Mail Archives: djgpp/1998/09/05/00:11:15
On 4 Sep 98 at 17:39, Jason wrote:
> Well, I tried using gxx and it worked! It kinda pisses me off that
> DJGPP never gives examples of compiling C++ progs from the command line
> - I was given the impression that I only needed to use gcc and it would
> do everything for me, since that's what the DJGPP User's Guide said on
> the website. I guess that's what you can expect from a free compiler
> huh? :O)
The file `readme.1st' describes how to install and use djgpp to
compile and link C and C++ programs. `gcc' knows when compiling that
C++ programs need to go through the C++ compiler, not the C compiler
-- that's what it decides based upon the filename (`*.c' are C source
code, `*.C *.cc *.cpp' are C++ source code).
At link time however, C and C++ programs all boil down to a
collection of object files, and the linker needs to be told which
libraries to link in. By default it links in the standard C library
but not the C++ library. If you want the C++ library you should use
g++ or gxx, just as you would on Unix, or specify the C++ library
explicitly on the gcc command line.
If you use the RHIDE integrated development environment, I believe
it will decide what to link based upon your source file's extension.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -