conflicting declaration for iostream, namespace conflict?

Discussion in 'C++' started by humble04@gmail.com, Dec 29, 2004.

  1. Guest

    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
     
    , Dec 29, 2004
    #1
    1. Advertising

  2. <> 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::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
     
    Victor Bazarov, Dec 29, 2004
    #2
    1. Advertising

  3. Guest

    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:
    > <> 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::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
     
    , Dec 29, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Tiger
    Replies:
    10
    Views:
    5,631
  2. ai@work
    Replies:
    9
    Views:
    556
    Ron Natalie
    Dec 16, 2004
  3. S. Nurbe

    iostream + iostream.h

    S. Nurbe, Jan 14, 2005, in forum: C++
    Replies:
    7
    Views:
    786
    red floyd
    Jan 15, 2005
  4. red floyd
    Replies:
    3
    Views:
    544
    Dietmar Kuehl
    Mar 8, 2005
  5. Replies:
    4
    Views:
    1,099
    Richard Tobin
    Dec 12, 2006
Loading...

Share This Page