delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/09/03:02:46

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: So.. What can be wrong here?
Date: Tue, 08 Oct 1996 20:00:47 -0700
Organization: Alcyone Systems
Lines: 27
Message-ID: <325B155F.3C91060A@alcyone.com>
References: <53epl5$5m0 AT ranger DOT interlink DOT no>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Kim Robert Blix wrote:

> compiled with "gcc hello.C" ..
> I get a "undefined reference to 'cout'"
> and     "undefined reference to 'ostream::operator<<(char *)'
    ...
> 
> And if i copile with "gcc hello.c" (standard c, not ++), It cant find
> iostream.h at all... Im New to both c and c++, so I recon it does not
> exist in regular c..

Yes.  There are no iostreams or operator overloading in C.

> but whats wrong with the c++ compiling then?

It's not having problems compiling them; it's having problems linking them.
Essentially, gcc is saying, "Okay, I understand what cout and the
ostream-overloaded << operator look like, but I don't know where to find
they are defined."

Put a `-liostream' at the end of the line and it will link.

-- 
                             Erik Max Francis | max AT alcyone DOT com
                              Alcyone Systems | http://www.alcyone.com/max/
                         San Jose, California | 37 20 07 N 121 53 38 W
                                 &tSftDotIotE | R^4: the 4th R is respect

- Raw text -


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