Mail Archives: djgpp/2002/04/05/04:49:45
> Some compilers know, for instance, that they should automaticly try a full
> C++ convention with source files that have the .cpp file extension, and an
> ANSI C convention when they end with .c
> But my DJGPP installation was trying to compile a C++ file only using
> default C libraries. Appearantly DJGPP does not support this
> 'file-extension-recognition', or?
Compiling and linking are different things. When you link with with
gpp/gxx/g++ it will automatically link in the standard C++ library, e.g.:
gxx -o foo foo.o bar.o
Similarly gcc will link in the standard C library.
Now if you link multiple C++ object files together using:
gcc -o foo foo.o bar.o
then how does gcc know you're linking C++ objects together? Answer: it
doesn't. So you need to use gpp/gxx/g++ instead.
Note that if you compile and link a C++ program in one line, then gcc knows it
should link in the standard C++ library, because it knows its C++ from the
gcc -g -Wall -o foo foo.cpp
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -