g++ setup

John D Lamb J.D.Lamb at btinternet.com
Sun Feb 14 20:23:39 UTC 2010

> 	I tried all the flags without success. The 10-04 system has 
> ANSI/ISO Standard C++  and that is that. What does work is 
> changing code in the program listings.
> 	My older 9.04 uses Standard C++ and in the program you use 
> #include<iostream.h> which works fine.
> 	On 10-04 you need #include<iostream> AND using namespace std;
> 	It appears no flag can do this.

To #include<iostream.h> you need a file called "iostream.h", which has
been deprecated for a while. I guess the following hack would work, but
I haven’t actually tried it.

1. Create a directory, say /home/user/include
2. Create a file iostream.h in the directory containing

#ifndef IOSTREAM_H
#define IOSTREAM_H
using namespace std;

3. Compile with the flag -I/home/user/include

Then if your C++ header has #include<iostream.h> in it, it should read
iostream instead and put its definitions in the global namespace.

Personally I would rather update the C++ code. But I guess it depends on
on your needs.


More information about the ubuntu-users mailing list