delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/29/12:11:41

From: "Daniel Mironowicz" <danielm9 AT polbox DOT com>
To: <djgpp AT delorie DOT com>
Subject: Re: My first steps
Date: Sat, 29 Aug 1998 18:09:37 +0200
Message-ID: <01bdd367$6bd2a0e0$LocalHost@default>
MIME-Version: 1.0

This happens  because you forgot to link your program with C++
library. Try this:  "gcc hello.cpp -o hello.exe -lm -lstdcxx"

Holger wrote:
>  Hello All !
>
>  I've just downloaded DJGPP V2 and installed it on my OS/2-System. But
>I'm quite new to C++ and have some problems with compiling the following
>program, which works fine with IBM C-Set:
>
>        #include <iostream.h>
>        int main(void) {
>          cout << "Hello World";
>        }
>
>  When compiling it with "gcc hello.cpp -o hello.exe -lm" I get the
>following error:
>
>        c:/prg/anw/djgpp/tmp\cccanohi(.text+0x15):hello.cpp: undefined
>reference to `cout'
>        c:/prg/anw/djgpp/tmp\cccanohi(.text+0x1a):hello.cpp: undefined
reference to `ostream::operator<<(char const *)'
>
>  If I use "printf" instead of "cout" everything works fine. Is this an
DJGPP problem or am I just to stupid to write a simple cpp-program ?
>
>        Holger
>
>---
>Jerakeen @ gmx.net
>Holger Merk @ 2:2443/2011.12
>http://online-club.de/m1/Jerakeen
>## CrossPoint v3.11 R ##
>
>

- Raw text -


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