Mail Archives: djgpp/1998/12/02/05:13:50
On Tue, 1 Dec 1998, Arthur wrote:
> Then why can I compile a file with the .cc or .cpp extension using gxx but
> not with gcc? It doesn't work on my system, not unless I specify that my
> file has to link with -lstdcxx.
You are mixing compilation with linking. Linking C++ programs without
explicitly mentioning -lstdcxx on the command line is indeed
impossible with gcc, whereas gxx does that for you.
But the source file name extension has nothing to do with that: GCC
only looks at the file name extension when it decides which programs
to invoke (it calls cc1.exe for .c, cc1plus.exe for .cc or .cpp, etc.;
see section 8.4 of the FAQ for the details). GCC does NOT consult the
file name extension when passing names of the libraries to search to
the linker.
What gxx does is just add -lstdcxx to the libraries it passes to the
linker, no matter which language the sources are.
> the Zip Picker said use gxx and that's what I've been doing
> for the past eight months or so that I've been using DJGPP.
The Zip Picker isn't wrong, since every program needs eventually to be
linked, and it is simpler to tell people to use a single program (gxx)
rather than verbosely explain what I wrote above. But the truth is
that gxx is *required* only for linking; compilation can be done by
gcc as well.
Now, if you cannot *compile* a C++ programs with "gcc -c foo.cc", then
please report that, since that *should* work.
- Raw text -