CSC 101 Frequently Asked Questions (FAQ)
-- last updated 18may99 --
This file contains a compendium of frequently asked questions from CSC 101, Spring quarter 1999. The questions are in chronological order of being asked, starting with the most recently asked.
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? 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:/usr/ccs/bin/ld: Unsatisfied symbols: sqrt (code) pow (code)
give the following weird error message?cc program1.cpp
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./usr/ccs/bin/ld: program1.cpp: Not a valid object file (invalid system id)