delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/21/22:59:39

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199706220258.AA066858338@typhoon.rose.hp.com>
Subject: Re: trouble compiling c++
To: john DOT syers AT compaq DOT com (John Syers)
Date: Sat, 21 Jun 1997 19:58:58 PDT
Cc: djgpp AT delorie DOT com
In-Reply-To: <01bc7c34$774cd980$453f19ac@elihu.sys.hou.compaq.com>; from "John Syers" at Jun 18, 97 10:09 pm

> anyway, on my pentium i've had a lot of problems.  I tried compiling the
> 'hello' program in c & c++.  no luck at first; the error message said that
> it didn't recognize the directive (#include).  When I moved the #include
> from line 1 to line 3, the c program compiled.
Posting the exact error  message and the original file would be helpful
here.

> After it recognized the include, I got these messages:
> 
> c:/djgpp/tmp\ccdaaaaa(.text+0x12):test.cc: undefined reference to
> `endl(ostream&)'
> c:/djgpp/tmp\ccdaaaaa(.text+0x1c):test.cc: undefined reference to `cout'
> c:/djgpp/tmp\ccdaaaaa(.text+0x21):test.cc: undefined reference to
> `ostream::operator<<(char const *)'
> c:/djgpp/tmp\ccdaaaaa(.text+0x2c):test.cc: undefined reference to
> `ostream::operator<<(ostream &(*)(ostream &))'
> 
> how can I correct this?  As far as I know my djgpp.env is okay; this is
> what it looks like:

Well, you should either invoke gxx instead of gcc when compiling 
c programs, or, manually specify the c++ libraries by doing

gcc file.c -lstdcx -liostrm 

iostream may be mispelled, if you run gxx with -v option it will 
show exact library name.

Andrew

- Raw text -


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