CSC 101 Frequently Asked Questions (FAQ)
sorry, not implemented: initialization of ... (automatic aggregate, compile with +a1) (2043)
Answer: The central UNIX CC compiler requires that you use the "+a1" argument to compile any C++ program that contains aggregate array initialization. Put the "+a1" argument immediately after the CC command, as in
CC +a1 some-array-program.cpp -o some-array-program
when I try to compile a program that uses functions such as sqrt and pow from the math library, even if I have #include <math.h> in my program?/usr/ccs/bin/ld: Unsatisfied symbols: sqrt (code) pow (code)
Answer: The CC compiler on the Cal Poly central UNIX system requires an extra argument in order to use the math library. Specifically, you must put the argument "-lm" at the end of the compile command. That's a dash, followed by the lowercase letter ell, followed by the lowercase letter em. Here is an example of the complete compile command, updated from the dissected command given in the Week 2 Lab Notes:
give the following weird error message?cc program1.cpp
/usr/ccs/bin/ld: program1.cpp: Not a valid object file (invalid system id)
Answer: Because UNIX is case sensitive, and the command to run the C++ compiler must be CC (that's two capital C's) not cc, which is what the command above is. BTW, cc (that's two lower case c's) is the compiler for the C programming language (as opposed to C++). So, when you type cc it's trying to compile a C++ program with the plain C compiler, and it's really confused.
Answer: Yes, in order to keep your programs nicely organized, and to understand the instructions for the turnin command. The following are the program file naming conventions you must use:
Answer: You need to use the "-a" argument to ls in order to see files that start with a period, such as ".emacs".
Answer: You need to use the UNIX shell called the "t-shell" (tcsh). To change to this shell permanently for the rest of the quarter, type the UNIX command chsh, with no arguments. The chsh command will prompt you with several choices for your shell. Type in the selection "/bin/tcsh" at the prompt. The next time you login, you will then be using the t-shell, and the tab character can be used for filename completion.