www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/27/00:46:16

From: "Donald Xie" <donald_RemoveWhenReply AT iinet DOT net DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: How to use Namespace?
Date: Thu, 27 Nov 1997 11:16:02 +0800
Organization: iiNet Technologies
Lines: 34
Message-ID: <65ip6t$8b$1@news.iinet.net.au>
NNTP-Posting-Host: gothic76.nv.iinet.net.au
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi DJGPP Gurus,

I'm new to djgpp with some fairly limited C++ knowledge.  When I tried to
compile the following program:

+-- Test Program ----------
#include <iostream>
using namespace std;
int main()
{
 cout << "Hello world!" << endl;
 return 0;
}
+-- End of test program ----------

Command: gcc -Wall -c hello.cpp, I got the following error:
hello.cpp:1: iostream: No such file or directory (ENOENT)

Using #include <iostream.h> without namespace works fine.  Sure I've missed
something here?

The real problem is when I try to use STL string class, #include <string.h>
gives me the C string (char*) functions instead of the C++ string class
while using #include <string> in namespace std gives the above compile
error.  I've checked the documentation but could not find any reference to
this.  Could anyone tell me how this can be done please?

Thanks in advance for all replys.
Donald





- Raw text -


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