delorie.com/archives/browse.cgi | search |
From: | ab837 AT sfn DOT saskatoon DOT sk DOT ca (James Edwin Cooper) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Newbie iostream problem |
Date: | 15 Jul 1997 05:50:48 GMT |
Organization: | Saskatoon Free-Net |
Lines: | 31 |
Message-ID: | <5qf33o$6m0$2@missing.link.ca> |
References: | <199707071519 DOT IAA23822 AT adit DOT ap DOT net> |
NNTP-Posting-Host: | broadway.sfn.saskatoon.sk.ca |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Nate Eldredge (eldredge AT ap DOT net) wrote: : 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 If you don't have gxx and you are running the DOS version you can type: gcc work.cc -o work -lgpp the -lgpp says to add the C++ library which will allow you to use cout. -Alwasy happy to help (as I'm flamed often :)
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |