delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/12/05:01:16

From: rjvdboon AT cs DOT vu DOT nl (Boon van der RJ)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help with setup
Date: 10 Nov 1997 13:20:32 GMT
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Lines: 31
Message-ID: <6471n0$9cn$1@star.cs.vu.nl>
References: <Pine DOT GSO DOT 3 DOT 93 DOT 971109161044 DOT 16637A-100000 AT eve DOT albany DOT edu>
NNTP-Posting-Host: sloep24.cs.vu.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019