cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/06/01:51:38

Date: Thu, 5 Feb 1998 20:54:52 -0800 (PST)
Message-Id: <199802060454.UAA04089@adit.ap.net>
Mime-Version: 1.0
To: Pat <francis AT megsinet DOT net>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: C++ undefined referance error

At 03:47  2/5/1998 -0600, Pat wrote:
>Hello, could someone please tell me why djgpp won't compile this code?
>
>#include <iostream.h>
>int main()
>{
>    cout << "hello world";
>    return 0;
>}
>
>    I've been compiling C programs for a while now with no problems, but
>when I went to try c++ I got two errors:
>". . . .ex1.cpp:  undefined reference to 'cout'" and
>". . . .undefined reference to 'ostream::operator<<(char const *)'"
>
>I downloaded the c++ libraries again and the c++ executable and made
>sure to end my file with *.cpp.  Also, I checked the faq but I couldn't
>find anything about this. 
Really? What about section 8.7, or perhaps the README.1ST file? Both mention
that when linking C++ programs you must tell the linker to search the C++
libraries. The most convenient way to do this is to use `gxx' instead of
`gcc' when you link C++.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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