www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/03/13/16:36:25

Xref: news2.mv.net comp.os.msdos.djgpp:1831
From: deafen AT imap2 DOT asu DOT edu
Newsgroups: comp.os.msdos.djgpp
Subject: Problem with cout in V2
Date: 13 Mar 1996 17:22:20 GMT
Organization: Arizona State University
Lines: 38
Message-ID: <4i708c$8as@news.asu.edu>
NNTP-Posting-Host: general3.asu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Skinny:
OS: Dos 7.0 (Win95)
DPMI: CWSDPMI
DJGPP: V2, djdev, gcc 2.7.2, bnu 2.5.2, gpp 2.7.2, libgpp 2.7.1
Installed to D:\DJGPP

Code:
// test.cpp
#include <iostream.h>

main()
{
  cout << "This is a test.\n";
  return 0;
}

Errors:
At compile time, this gives undefined reference errors for 'cout' and 
'ostream::operator<<(char const *)'.

DJGPP.ENV is properly specified in the environment, and is correct.  cpp 
properly preprocesses; the error apparently occurs at link time, judghing 
by the output of gcc -v -o test.exe test.cpp.

If the character literal is changed to an integer literal (cout << 8;) 
the second error becomes 'ostream::operator<<(int)'.

This is apparently a problem with either iostream.h or libgpp.  Am I 
misusing the cout stream, or does G++ handle iostreams differently than 
other versions of C++?

Thanks in advance for any help you can offer.

--
Hal Haygood :: PC/Network/Unix technician, Suntek Integrated Technologies
hal AT suncap DOT com  ::  deafen AT asu DOT edu  ::  hagar AT mail DOT hvs DOT com
My opinions and those of my employer rarely, if ever, coincide.

- Raw text -


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