473,545 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3964
<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2206
by: John Ky | last post by:
Hello: Building Python works fine. Now I am trying to build my own python module on Solaris 9, but I'm getting the following conflict: In file included from /wrk/src/test/tools/local/include/python2.2/Python.h:62, from elxml.cpp:20: /wrk/src/test/tools/local/include/python2.2/pyport.h:333: declaration of C function `int...
2
6381
by: Jacek Dziedzic | last post by:
Is it valid to use a "using namespace foo" (as opposed to using foo::bar which I'm sure is legal) within a class declaration? My compiler rejects it, but I've been told it's valid. Can anyone please confirm or deny? TIA, - J.
9
2353
by: ai | last post by:
Hi , I have an application which has to read files of size few mba nd read them into array . Since i am using STL and std namespace to avoid the error error C2872: 'ifstream' : ambiguous symbol when i include <iostream.h> with std namespace and <List>
6
8108
by: user | last post by:
Hi, I got this error and donno know how to fix it: In file included from ../except.h:53, from group.c:22: .../portspecs.h:81: error: conflicting types for `const double __infinity' /usr/include/math.h:26: error: previous declaration as `const __dmath __infinity'
2
4495
by: Plok Plokowitsch | last post by:
After over a decade of programming in C++ I seem to have missed some substantial point (mental note: am I getting too old for this?). A little bit of help would be *very* appreciated. I'm trying to gather various different classes into a common namespace using typedefs: class QWidget {}; class MyListview {}; namespace gui
4
35013
by: Juhan Voolaid | last post by:
Hi I need help here. When i compile my program, i get this error: $ make g++ -c -Wall inf2_functions.cpp -o inf2_functions.o inf2_classes.h:6: error: ISO C++ forbids declaration of ‘vector’ with no type inf2_classes.h:6: error: expected ‘;’ before ‘<’ token make: *** Error 1
8
9283
by: Lathe_Biosas | last post by:
Hi While compiling my application that needs "windows.h" there are some typedef redefinition errors redefinition at winnt.h( line 207) typedef void *HANDLE redefinition at windef.h( line 143) typedef unsigned char BYTE redefinition at windef.h( line 141) typedef unsigned long DWORD #define INVALID_HANDLE_VALUE -1 redefinition at...
11
3895
by: alex sparsky | last post by:
I have a rather unique problem that I need some advice on. I have multiple c# controls that need to make use of a common namespace. So when I go to include both controls that make use of that common namespace and one control has a newer version of that namespace, the compiler complains about ambiguous references. I've tried using...
2
2186
by: Layton | last post by:
Hi, CPP gurus, How to use friend function cross the namespace? I have the following sample code with operator << overloaded, it's working. The problem the operator << function can't access private class (myPoint) member x and y directly and I have to use getters to make it work. If there is no namespace, direct access myPoint::x and y is...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7918
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7436
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7766
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1022
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
715
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.