delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/23/19:43:35

Date: Thu, 24 Feb 2000 06:00:59 +0600 (LKT)
From: Kalum Somaratna aka Grendel <kalum AT crosswinds DOT net>
X-Sender: root AT darkstar DOT grendel DOT net
To: djgpp AT delorie DOT com
cc: Jan Hader <Jan DOT Hader AT post DOT rwth-aachen DOT de>
Subject: Re: Q: What am I doing wrong ?
In-Reply-To: <38B42032.DB19F1BD@post.rwth-aachen.de>
Message-ID: <Pine.LNX.4.10.10002240530030.852-100000@darkstar.grendel.net>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 23 Feb 2000, Jan Hader wrote:

> Hello there...
> 
> I downloaded DJGPP and unzipped everything on d:\djgpp.
> Now I am able to write little programs, but references to e-g iostream
> do ot work, it says something about "undefined reference".
> Now what should I do ?
> (I have tried to copy the file iostream.h to nearly every directory of
> DJGPP but it does not work)

This is because you have to instruct the linker to link in the c++ library
if you are using gcc to compile, otherwise the linker can't find the c++
library and you will get undefined references. 

You should add the -lstdcx option if you use gcc.
A example compile would go like "gcc name.cc -o name.exe -lm -lstdcx"
withought the quotes.

Or you can use gpp.exe which will automatically link in the c++ library.


> 
> 
> P.S.: I start to compile with gcc name.cc -o name.exe -lm , perhaps it
> is wrong?

Yes, you have to add the -lstdcx to the compile line if you use gcc... Or
use gpp like "gpp name.cc -o name.exe -lm" .




> P.P.S.: Dont laugh ! I started 2 days ago...

No way! Good luck and I hope you enjoy DJGPP!

Grendel

Hi, I'm a signature virus. plz set me as your signature and help me spread
:)



- Raw text -


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