delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/15/12:30:31

From: Dragos STOICHITA <stoichid AT esiee DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: iostream.h : problems when using function 'cout' and linking
Date: Tue, 15 Sep 1998 18:29:06 +0200
Organization: ESIEE
Lines: 41
Message-ID: <35FE95D2.72897F14@esiee.fr>
NNTP-Posting-Host: acme9.esiee.fr
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I wrote a (very) small program in C++, and I wanted to compile it with
DJGPP.

/* hello.cc */

#include <iostream.h>

int main()
{

cout << "Hello!" << endl ;

}

Then I wrote its makefile:

hello:	hello.o
	gcc hello.o -o hello.exe -lm -ansi

hello.o:	hello.cc
	gcc hello.cc -c -ansi

Then I tried to make it but it failed at linking saying:

hello.o(.text+0x12):hello.cc: undefined reference to 'endl (ostream&)'
hello.o(.text+0x1C):hello.cc: undefined reference to 'cout'
hello.o(.text+0x21):hello.cc: undefined reference to
'ostream::operator<<(char const*)'
hello.o(.text+0x2C):hello.cc: undefined reference to
'ostream::operator<<(ostream &(*)(ostream &))'

I looked in the libraries with nm and it seems that they are there.

I have been trying to solve the problem myself for hours and hours but I
didn't succeed, so I wrote this message to ask for help.

Thanks.

Dragos STOICHITA, 1st year student at ESIEE (http://www.esiee.fr/).

- Raw text -


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