delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/06/14:16:01

From: Patrick Griffiths <nospam AT po-box DOT mcgill DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Help: simple(?) linker problem
Date: Fri, 06 Mar 1998 13:59:26 -0500
Organization: McGill University Computing Centre
Lines: 25
Message-ID: <3500478E.527A1D36@po-box.mcgill.ca>
NNTP-Posting-Host: b52-23.das.mcgill.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

with the new gcc 2.8.0 when I try to compile this:

#include <iostream.h>

int main() {
   cout << "Hello, world! \n";
   return 0;
}

with the command line
gcc -Wall -o hello hello.cc

I get this linker error:
d:/djgpp/tmp/ccaaaaaa1.o(.text+0x19):hello.cc: undefined reference to
`cout'
d:/djgpp/tmp/ccaaaaaa1.o(.text+0x1e):hello.cc: undefined reference to
`ostream::operator<<(char const *)'

it works if I append -lstdcxx to the command line,
but the executable is 386,376 bytes!

First, what have I screwed up so that the linker can't
find the appropriate library on it's own and second
why is the executable so huge?

- Raw text -


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