delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/13/20:23:29

Date: Fri, 13 Mar 1998 17:22:59 -0800 (PST)
Message-Id: <199803140122.RAA06055@adit.ap.net>
Mime-Version: 1.0
To: crazor AT mail DOT execpc DOT com, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Link the object files

At 10:41  3/13/1998 -0600, crazor AT mail DOT execpc DOT com wrote:
>Hi, I use gcc -o exe_file obj_file.o
>to link the object file, but I got error like this
>
>hello.o(.text+0x14):hello.cpp:undefined reference to 'endl(ostream&)'
>hello.o(.text+0x1e):hello.cpp:undefined reference to 'cout'
>hello.o(.text+0x23):hello.cpp:undefined reference to 'ostream::operator<<(char
>const *)'

Like README.1ST tells you, when linking C++, you should use the `gxx'
command instead of `gcc' so that the C++ libraries get linked.

>
>My c++ code is simple like this
>#include <iostream.h>
>
>void main(void) {
>  cout << "hello...test" << endl;
>}

ANSI requires that `main' return `int'.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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