delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/25/14:38:49

Message-ID: <3773CC7A.36623262@calderathin.com>
Date: Fri, 25 Jun 1999 12:37:46 -0600
From: Jared Stevens <stevja AT calderathin DOT com>
X-Mailer: Mozilla 4.6 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Problem. Please Help. Thanks.
References: <19990624212725 DOT 22553 DOT 00003367 AT ng-fv1 DOT aol DOT com>
Reply-To: djgpp AT delorie DOT com

RPLATLANTA wrote:
> 
> with the code:
> 
> #include <iostream.h>
> 
> int main();
> int main ()
> {
>    cout << "Hello World!\n";
>    return 0;
> }
> 
> i typed:
> 
> gcc hello.cpp -o hello.exe
> 
> and received the error message:
> 
> C:\WINDOWS\TEMP\cccyeivk(.text+0x19):hello.cpp: undefined reference to 'cout'
> C:\WINDOWS\TEMP\cccyeivk(.text+0x1e):hello.cpp: undefined reference to
> 'ostream::operator<<(char const *)'
> 
> could someone please tell me what to do? thanks.

cout is a c++ call and you are compiling with the regular 'C' compiler.
To get that program to work you need to use 'gxx'. (e.g instead of gcc
hello.cpp -o hello.exe try gxx hello.cpp -o hello.exe) If your computer
doesn't know what gxx is or it has problems you need to download
gpp281b.zip from the simtel archive, then unzip it (if with pkunzip use
the -d flag) in your djgpp directory and try to compile with gxx again.

- Raw text -


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