Mail Archives: djgpp/1996/11/02/14:53:43
In article <32758D7D DOT 4EF28B3E AT alcyone DOT com> Erik Max Francis <max AT alcyone DOT com> writes:
>Greeny wrote:
>
>> Whenever, I try and use GCC to compile C++ programs, it doesn't find the
>> libraries and compile correctly. eg. It will not recognise cout and
>> gives me an error. What am I doing wrong?
>
>This has to be by far and away the most common frequently-asked DJGPP
>question.
>
>The answer is that you're not linking in the appropriate C++ libraries.
>Put -liostream on the link line (before the -o argument) or use gxx instead
>of gcc.
I believe that the position of -liostream relative to the -o argument is
irrelevant, but that what is important is that -liostream comes AFTER
all the files to be compiled or linked.
gcc -o program -liostream program.cc funct.cc
will fail
gcc -o program program.cc funct.cc -liostream
will succeed.
The -o argument can go anywhere on the line, so
gcc program.cc funct.cc -liostream -o program
will succeed
--
Peter King, Computing & Electrical Eng. Internet: pjbk AT cee DOT hw DOT ac DOT uk
Heriot-Watt University, Riccarton, or P DOT J DOT B DOT King AT heriot-watt DOT ac DOT uk
Edinburgh EH14 4AS, Scotland
Phone: (+44) 131 451 3433 Fax: (+44) 131 451 3431
- Raw text -