Mail Archives: djgpp/1997/11/12/05:01:16
DELCO J (jd3881 AT csc DOT albany DOT edu) wrote:
>Hello,
> Am having a bit of trouble with installing the dgjpp 32 bit protected
It isn't the installing part.
>mode compiler on my computer. I have followed the instructions, and when
>I try to compile a simple program, I get an error message saying that
>'cout' isn't defined. I'm using #include <iostream.h>, and cout <<"
>string";. The iostream.h file was installed to the c:\djgpp\lang\cxx
>directory. As per the djgpp faq, I have included the contents of my
>environ.lst, autoexec.bat and config.sys.
It's a common mistake among newbies, you should link the library
for the functions you use. In this case you should compile your program
with
gcc -o file.exe file.cc -liostream
or (which does the equivalent)
gxx -o file.exe file.cc
this is because the linker doesn't know anything about the
implementation of 'cout <<' which is in libiostream.a
(you don't need it -lc for c/c++ programs, because libc is linked in
by default.)
Remember to put the libraries to be linked into your program as the
last parameters in your command line.
hth,
Robert
--
rjvdboon AT cs DOT vu DOT nl | "En dat is niet waar!" sprak Staatsecretaris
www.cs.vu.nl/~rjvdboon | Netelenbos (onderwijs) fel.
- Raw text -