Linux C++ Help
Momchil Velikov
velco@fadata.bg
Fri Dec 6 04:59:00 GMT 2002
>>>>> "Jayanta" == Jayanta Narayan Choudhuri <sss@cal.vsnl.net.in> writes:
Jayanta> 1. gcc -o x.exe jnc.c # WORKS
Jayanta> 2. gcc -o x.exe jnc.cpp # FAILS even though jnc.c
Jayanta> & jnc.cpp are identical
But are compiled as different languages, C++ does NOT implicitly
declare ``int strlen (...)''.
Jayanta> 3. g++ -o x.exe jnc.cpp # also FAILS
For the same reason.
Jayanta> 4. g++ -o x.exe gplus.cpp # also fails though I used the
Jayanta> recommended headers of C++
Same reason.
the above errors are NOT linking errors, too.
Adding ``#include <string.h>'' or ``#include <cstring>'' fixes the
above compilations.
Also, you should link C++ programs with the C++ compiler driver
``c++'' (or ``g++'') or, alternatively, specify the C++ libraries,
i.e., either
c++ -o xx jnc.cpp
or
gcc -o xx jnc.cpp -lstdc++
~velco
More information about the Gcc-help
mailing list