conflicting declaration for iostream, namespace conflict?

H

humble04

Hi,

I am compiling a collection of C++ code. Most of them are using the new
format #include <iostream>. I think all of them because I failed at
finding out which header file uses the old format #include
<iostream.h>. However, I met the following error messages.

"/usr/vacpp/include/iostream.h", line 74.7: 1540-0400 (S) "class
ostream" has a conflicting declaration
"../include/myfile.h", line 7.1: 1540-0424 (I) "ostream" is declared on
line 7 of "../include/myfile.h".

in "myfile.h", it declares
#include <iostream>
using std::streambuf;
using std::eek:stream;

The platform I am working on is IBM SP2 using xlC_r (VisualAge C++
Professional / C for AIX Compiler, Version 6).
Did you ever have similar problems? Thanks a lot.

Alex
 
V

Victor Bazarov

I am compiling a collection of C++ code. Most of them are using the new
format #include <iostream>. I think all of them because I failed at
finding out which header file uses the old format #include
<iostream.h>. However, I met the following error messages.

"/usr/vacpp/include/iostream.h", line 74.7: 1540-0400 (S) "class
ostream" has a conflicting declaration
"../include/myfile.h", line 7.1: 1540-0424 (I) "ostream" is declared on
line 7 of "../include/myfile.h".

in "myfile.h", it declares
#include <iostream>
using std::streambuf;
using std::eek:stream;

The platform I am working on is IBM SP2 using xlC_r (VisualAge C++
Professional / C for AIX Compiler, Version 6).
Did you ever have similar problems? Thanks a lot.

Yes, I actually have seen something of the sort. It turned out that
in the old code I had to maintain, both <iostream> and <iostream.h>
were used without care. I had to weed out all uses of the old non-
standard header (<iostream.h>) and the problem had gone away.

Search through all source files and headers and remove non-standard
"library" headers like <iostream.h>. Standard C++ headers do not
have the '.h' in their names.

Victor
 
H

humble04

Thank you very much Victor. I finally found that I missed a small
header file in a subdirecotry that includes "iostream.h". The
conflicting problem is solved. What a good day :).

Enjoy your holiday.

Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top