delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/31/02:00:28

Xref: news2.mv.net comp.os.msdos.djgpp:666
Newsgroups: comp.os.msdos.djgpp
From: rjvdboon AT cs DOT vu DOT nl (Boon van der RJ)
Subject: Re: I can't compile C++...
Nntp-Posting-Host: sloep06.cs.vu.nl
References: <DL76yo DOT 4Fx AT jade DOT mv DOT net> <30fb0332 DOT 1350250 AT nntp DOT ix DOT netcom DOT com> <4e9rbc$dlk AT mack DOT rt66 DOT com>
Sender: news AT cs DOT vu DOT nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Date: Fri, 26 Jan 1996 07:49:48 GMT
Message-ID: <DLs330.Br8.0.-s@cs.vu.nl>
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

elerath AT Rt66 DOT com wrote:
> In <30fb0332 DOT 1350250 AT nntp DOT ix DOT netcom DOT com>, dannyyoo AT ix DOT netcom DOT com (Danny Yoo) writes:
>>Ian Viemeister <vmeister AT ios DOT com> wrote:
>>>>merry way until it started spitting out errors when it saw cin and cout 
>>>>(BTW, I did #include<iostream.h>). It didn't give me line numbers for 
>>>
>>>You have forgotten to add -lgpp to the gcc command line. This tells 
>>the linker to add in the C++ libs. Please note, this is likely the 
>>>*most* Frequently Asked Question about compiling C++, and it is 
>>>answered in the FAQ (faq102.zip at the DJGPP sites)
> >
>>	I'm having the same stupid problem, but I AM using
>>gcc -lgpp [filename], and it still does it.  Here's my program and the
>>output:
>>
>>#include "iostream.h"
>>void main(void) {
>>	cout << "Hello World!\n";
>>}
>>
>>
>>test.cc(.text+0x1c): undefined reference to `cout'
>>test.cc(.text+0x21): undefined reference to `ostream::operator<<(char
>>const *)'

>I am having _*exactly*_ the same problem with _*exactly*_ the same program.
>I have screwed around for hours and don't know what to do.  I have checked
>to be sure that cplusinc is in my .env file correctly, run gcc -lgpp [filename], 
> etc.  My error message is identical (except that i called my program hello.)

and that is because you have to add -lgpp _after_ all other options on the
command-line (i.e. the libs to include should be last on your command line,
this is because of the way gcc reads it's options, and sends them to the
programs it invokes). And this is in the FAQ, at least, I suppose :-)

Hope to be helpfull,
 Robert

- Raw text -


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