www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/29/17:18:09

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: error whe compile with djgpp
Date: Sun, 30 Nov 1997 16:10:15 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 38
Message-ID: <34818FE7.782C@cs.com>
References: <34803869 DOT 5A39 AT videotron DOT ca>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp202.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Rivet-Sabourin wrote:
> 
> Why when compile simple progam like:
> [snip]
> c:\djgpp/tmp\ccdaaaaa(.text+0x16):test.cc: undefined to 'cout'
> c:\djgpp/tmp\ccdaaaaa(.text+0x16):test.cc: undefined to
> 'ostream::operator << (char const*)'

Because you didn't follow the instructions.  To properly link C++ code,
you must add the C++ libraries to the command line:

gcc -o myprog.exe myprog.cpp -lgpp

You can also use 'gxx' instead of 'gcc', which adds the libraries
automatically.

BTW...

> void main()
> {
> cout << "Allo";
> }

void main() is illegal C/C++.  main() must always return an integer.

int main( void )
{
    cout << "Allo";
    return 0;
}

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "A committee is a life form with six |
|       aka Fighteer I       | or more legs and no brain."          |
|   mailto:fighteer AT cs DOT com   |                                      |
| http://www.cs.com/fighteer |                 - Lazarus Long       |
---------------------------------------------------------------------
mmittee is a life form with six |
|       aka Fighteer I       | or more legs and no brain."          |
|   mailto:fighteer AT cs DOT com   |                                      |
| http://www.cs.com/fighteer |                 - Lazarus Long       |
---------------------------------------------------------------------

- Raw text -


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