Mail Archives: djgpp/1997/04/20/10:33:44
From: | Erik Max Francis <max AT alcyone DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Help! problem not in docs!
|
Date: | Sat, 19 Apr 1997 18:48:28 -0700
|
Organization: | Alcyone Systems
|
Lines: | 26
|
Message-ID: | <335975EC.152AA852@alcyone.com>
|
References: | <5jbm3f$mga AT news DOT interlog DOT com>
|
NNTP-Posting-Host: | newton.alcyone.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
jackelope wrote:
> i get some stuff on the screen that lists dirs being searched
> for the #included file(iostream.h). when the compiler gets to
> the instructions like:
>
> cout << "hello\n";
>
> i get an 'undefined reference to cout' and 'undefined reference
> to ostream' messages. it appears the compiler cannot find the
> iostream.h header file.
No, undefined references are from the linker. In this case, you're just
not linking in the C++ libraries. Run gxx instead of gcc and it will work.
And, incidentally, you should end lines with endl, rather than putting a
newline in the string. cout is buffered; endl tells it to end the line and
flush the buffer, whereas just sending "\n" doesn't.
--
Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
Alcyone Systems / web / http://www.alcyone.com/max/
San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W
\
"The future / is right there."
/ Bill Moyers
- Raw text -