469,623 Members | 1,380 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

conflicting declaration for iostream, namespace conflict?

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::ostream;

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

Jul 22 '05 #1
2 3648
<hu******@gmail.com> wrote...
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::ostream;

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
Jul 22 '05 #2
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
Victor Bazarov wrote:
<hu******@gmail.com> wrote...
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::ostream;

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


Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jacek Dziedzic | last post: by
6 posts views Thread by user | last post: by
2 posts views Thread by Plok Plokowitsch | last post: by
4 posts views Thread by Juhan Voolaid | last post: by
11 posts views Thread by alex sparsky | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.