With the .cpp extension, your source file will be compiled as a C++
source file. But, by using the name gcc to call the compiler, you are effectively saying that you only need the C libraries. To get the C++ libraries, you should use the name g++: g++ -o test test.cpp
Saturday, June 10, 2006
gcc vs. g++: compiler issues
The GCC package contains compilers for several different languages. The extension on the source-file determines which language the compiler will recognise, but the name that you use to invoke the compiler will determine which libraries will be included by default.
Subscribe to:
Posts (Atom)