delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/07/11:21:02

Date: Mon, 7 Jul 1997 08:19:37 -0700 (PDT)
Message-Id: <199707071519.IAA23822@adit.ap.net>
Mime-Version: 1.0
To: johnsoth AT carleton DOT edu
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Newbie iostream problem
Cc: djgpp AT delorie DOT com

You wrote:
>I am making the transition from c to c++ and I'm trying to figure out djgpp
>at the same time. When I compile the following code from the iostream docs:
> [C++ Hello world program deleted]
>I get the following errors:
>c:/djgpp/tmp\ccdaaaaa(.text+0x22):work.cc: undefined reference to `cout'
>c:/djgpp/tmp\ccdaaaaa(.text+0x27):work.cc: undefined reference to
>`ostream::oper
>ator<<(char const *)'

What did the command line invoking the compiler look like? My guess is
something like:
gcc -o work work.cc
The problem with this is it doesn't know to link in the C++ libraries. Try this:
gxx -o work work.cc

gxx is the same as g++ on a unix box, just DOS doesn't allow `+' in a
filename. gxx automatically looks in the C++ libraries.

HTH

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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