Quote:
Originally Posted by jim mcnamara
1. this forum is really not for homework
2. if gcc reports syntax errors, that means the code needs to be changed.
3. gcc myfile.c compiles C code not C++ code.
4. g++ myfile.cpp compiles C++ code
C++ and C are very different languages, compilers that expect C (gcc) will not compile C++ code.
ok, this is sort of a misconception. gcc compiles both. I just finished an ADMIN control area in C++ with the .cpp extension and compiled it with gcc without problem. but in response to the actual problem here, id just use this line.
we'll call the source EXAMPLE.cpp, and the output will be EXOUT."file".
gcc -lg++ -Wall -pedantic -ansi -g -o EXOUT EXAMPLE.cpp
this is a good choice for debugging and compiling, it calls upon the normal system area for #include header files, uses the Wall function for the debugging side of things, ansi for ..... ansi compatibility i think and the -o gets rid of the a.out leaving you with the desired file, with the blank extension for linux/Unix.... hope that helped..Pe@cE