error C2872: 'streambuf' : ambiguous symbol Problem

P

Prasad

HI,
I am a beginner in VC++..
I am trying to write a Win32 console application in visual studio..
I am using following header files..

#include <STRING>
using namespace std;

#include <hash_map>//from Standard template library
//and some other headers

When i complie my code , i am getting the follwing errors ...

c:\program files\microsoft visual studio\vc98\include\istream.h(102) :
error C2872: 'streambuf' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(117) :
error C2872: 'streampos' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(118) :
error C2872: 'streamoff' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(119) :
error C2872: 'streampos' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(126) :
error C2872: 'streambuf' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(132) :
error C2872: 'ios' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(139) :
error C2872: 'istream' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(140) :
error C2872: 'istream' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(140) :
error C2872: 'ios' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(140) :
error C2872: 'ios' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(142) :
error C2872: 'istream' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(143) :
error C2872: 'istream' : ambiguous symbol
-----and so on...
Error executing cl.exe.

ChatServer.obj - 102 error(s), 0 warning(s)

------------------
If i comment any one of those header files, it's compiled with no
errors....
But i need those two headers to be included (Becoz, hash_map.h is being
used for hash data structures and string.h using namespace std. is
being used in some ou_thread.h which is for threads )..

How can i solve this problem?...
Plz help me out ..

Thanx in advance..

With reagrds
Prasad
 
V

Victor Bazarov

Prasad said:
I am a beginner in VC++..

You might then find 'microsoft.public.vc.*' hierarchy of newsgroups
useful as well...
I am trying to write a Win32 console application in visual studio..
I am using following header files..

#include <STRING>

I don't know of a standard header <STRING>. There is <string>, and
since C++ is case-sensitive language, I believe it has to be spelled
as specified. It is possible that you employed some kind of compiler
extensions, of course...
using namespace std;

#include <hash_map>//from Standard template library
//and some other headers

When i complie my code , i am getting the follwing errors ...

c:\program files\microsoft visual studio\vc98\include\istream.h(102) :

'istream.h' looks suspicious. Is it an older, pre-standard header (when
many of them had '.h' after the name)? Is it possible that you're using
<hash_map> from the source that is very old, pre-standard? Well, there
but some old sources might be written said:
error C2872: 'streambuf' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(117) :
error C2872: 'streampos' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(118) :
error C2872: 'streamoff' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(119) :
error C2872: 'streampos' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(126) :
error C2872: 'streambuf' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(132) :
error C2872: 'ios' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(139) :
error C2872: 'istream' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(140) :
error C2872: 'istream' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(140) :
error C2872: 'ios' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(140) :
error C2872: 'ios' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(142) :
error C2872: 'istream' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\istream.h(143) :
error C2872: 'istream' : ambiguous symbol
-----and so on...
Error executing cl.exe.

ChatServer.obj - 102 error(s), 0 warning(s)

That seems to indicate a conflict of dependencies. Make sure you have
the latest version of said:
But i need those two headers to be included (Becoz, hash_map.h is
being used for hash data structures and string.h using namespace

Note, none of them are actually ".h".
std. is being used in some ou_thread.h which is for threads )..

How can i solve this problem?...

You need to get in touch with makers of <hash_map> and see if they have
anything newer.

V
 
A

Alf P. Steinbach

* Prasad:
I am a beginner in VC++..
I am trying to write a Win32 console application in visual studio..
I am using following header files..

#include <STRING>
using namespace std;

#include <hash_map>//from Standard template library

Note that this is not (yet) a standard library header, but a common
library extension.

//and some other headers

When i complie my code , i am getting the follwing errors ...

c:\program files\microsoft visual studio\vc98\include\istream.h(102) :
error C2872: 'streambuf' : ambiguous symbol

It looks like you have written

#include <iostream.h>

instead of

#include <iostream>

and that you are using an old version of your compiler that still has
the old, non-standard <iostream.h> header available.

Try to correct that (if my assumption about your compiler is correct, I
also recommend upgrading the compiler -- it's free).

If using standard <iostream> doesn't help, post a minimal and complete
program that reproduces the problem.
 
P

Prasad

HI Victor Bazzrow ,

Thanx for ur reply..

That seems to indicate a conflict of dependencies. Make sure you have
the latest version of <hash_map> (wherever it is you got it from).


I got this <hash_map> from sgi latest version which is updated in June
8, 2000


Note, none of them are actually ".h".

Ya the two headers I am using are "no.h " files only..
 
P

Prasad

HI Victor Bazzrow ,

Thanx for ur reply..

That seems to indicate a conflict of dependencies. Make sure you have
the latest version of <hash_map> (wherever it is you got it from).


I got this <hash_map> from sgi latest version which is updated in June
8, 2000


Note, none of them are actually ".h".

Ya the two headers I am using are "no.h " files only..
 
P

Prasad

HI Victor Bazzrow ,

Thanx for ur reply..

That seems to indicate a conflict of dependencies. Make sure you have
the latest version of <hash_map> (wherever it is you got it from).


I got this <hash_map> from sgi latest version which is updated in June
8, 2000


Note, none of them are actually ".h".

Ya the two headers I am using are "no.h " files only..
 
P

Prasad

HI Alf P. Steinbach ,
Thanx for ur reply,
Alf said:
* Prasad:

Note that this is not (yet) a standard library header, but a common
library extension.



It looks like you have written

#include <iostream.h>

instead of

#include <iostream>

Yes said:
and that you are using an old version of your compiler that still has
the old, non-standard <iostream.h> header available.

Try to correct that (if my assumption about your compiler is correct, I
also recommend upgrading the compiler -- it's free).

If using standard <iostream> doesn't help, post a minimal and complete
program that reproduces the problem.

A minimal program that reproduces the problem is
the one I have described above itself..

#include <STRING>
using namespace std;
#include <hash_map>

If i try to compile these 2 lines also , I am getting the same problem
.....
 
A

Alf P. Steinbach

* Prasad:
[quoting signature etc.]

Please don't quote signatures.


* Prasad:
A minimal program that reproduces the problem is
the one I have described above itself..

#include <STRING>
using namespace std;
#include <hash_map>

If i try to compile these 2 lines also , I am getting the same problem
....

It compiles fine with Visual C++ 7.1, even with the uppercase "STRING"
(which should be lowercase).

I suggest you upgrade or downgrade your compiler, whichever version it is.

As a temporary solution it might work to just remove the "using
namespace std;" directive, or move it after all #include's.
 
P

Prasad

Alf said:
* Prasad:
[quoting signature etc.]

Please don't quote signatures.


* Prasad:
A minimal program that reproduces the problem is
the one I have described above itself..

#include <STRING>
using namespace std;
#include <hash_map>

If i try to compile these 2 lines also , I am getting the same problem
....

It compiles fine with Visual C++ 7.1, even with the uppercase "STRING"
(which should be lowercase).

I suggest you upgrade or downgrade your compiler, whichever version it is.

As a temporary solution it might work to just remove the "using
namespace std;" directive, or move it after all #include's.

hi,
Thanx for ur reply..
I moved using namespace std after all #include's.
those errors have been removed...

But , now I am getting a new list of errors...
c:\program files\microsoft visual studio\vc98\include\utility(27) :
error C2953: 'pair' : template class has already been defined
c:\program files\microsoft visual
studio\vc98\include\utility(27) : see declaration of 'pair'
c:\program files\microsoft visual studio\vc98\include\utility(31) :
error C2995: '==' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_pair.h(53) : see declaration of '=='
c:\program files\microsoft visual studio\vc98\include\utility(40) :
error C2995: '<' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_pair.h(59) : see declaration of '<'
c:\program files\microsoft visual studio\vc98\include\utility(55) :
error C2995: 'make_pair' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_pair.h(90) : see declaration of 'make_pair'
c:\program files\microsoft visual studio\vc98\include\utility(57) :
error C2011: 'input_iterator_tag' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\utility(58) :
error C2011: 'output_iterator_tag' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\utility(60) :
error C2011: 'forward_iterator_tag' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\utility(62) :
error C2011: 'bidirectional_iterator_tag' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\utility(64) :
error C2011: 'random_access_iterator_tag' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\utility(71) :
error C2982: 'iterator' : new template parameter list has less
parameters than the previous declaration
c:\program files\microsoft visual
studio\vc98\include\utility(71) : see declaration of 'iterator'
c:\program files\microsoft visual studio\vc98\include\utility(71) :
error C2953: 'iterator' : template class has already been defined
c:\program files\microsoft visual
studio\vc98\include\utility(71) : see declaration of 'iterator'
c:\program files\microsoft visual studio\vc98\include\utility(174) :
error C2983: 'reverse_iterator' : new template parameter list has more
parameters than the previous declaration
c:\program files\microsoft visual
studio\vc98\include\utility(174) : see declaration of
'reverse_iterator'
c:\program files\microsoft visual studio\vc98\include\utility(174) :
error C2953: 'reverse_iterator' : template class has already been
defined
c:\program files\microsoft visual
studio\vc98\include\utility(174) : see declaration of
'reverse_iterator'
c:\program files\microsoft visual studio\vc98\include\utility(180) :
error C2995: '==' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_iterator.h(498) : see declaration of '=='
c:\program files\microsoft visual studio\vc98\include\utility(192) :
error C2995: '<' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_iterator.h(509) : see declaration of '<'
c:\program files\microsoft visual studio\vc98\include\utility(291) :
error C2504: 'iterator<struct std::eek:utput_iterator_tag,void,void>' :
base class undefined
c:\program files\microsoft visual
studio\vc98\include\utility(318) : see reference to class template
instantiation 'std::eek:streambuf_iterator<_E,_Tr>' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) :
error C2995: '_Construct' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_construct.h(47) : see declaration of
'_Construct'
c:\program files\microsoft visual studio\vc98\include\xmemory(38) :
error C2995: '_Destroy' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_construct.h(57) : see declaration of
'_Destroy'
c:\program files\microsoft visual studio\vc98\include\xutility(20) :
error C2995: 'copy' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(267) : see declaration of 'copy'
c:\program files\microsoft visual studio\vc98\include\xutility(26) :
error C2995: 'copy_backward' : template function has already been
defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(390) : see declaration of
'copy_backward'
c:\program files\microsoft visual studio\vc98\include\xutility(30) :
error C2995: 'equal' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(534) : see declaration of
'equal'
c:\program files\microsoft visual studio\vc98\include\xutility(34) :
error C2995: 'equal' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(549) : see declaration of
'equal'
c:\program files\microsoft visual studio\vc98\include\xutility(39) :
error C2995: 'fill' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(442) : see declaration of 'fill'
c:\program files\microsoft visual studio\vc98\include\xutility(54) :
error C2995: 'lexicographical_compare' : template function has already
been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(564) : see declaration of
'lexicographical_compare'
c:\program files\microsoft visual studio\vc98\include\xutility(64) :
error C2995: 'lexicographical_compare' : template function has already
been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(583) : see declaration of
'lexicographical_compare'
c:\program files\microsoft visual studio\vc98\include\xutility(90) :
error C2995: 'mismatch' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(503) : see declaration of
'mismatch'
c:\program files\microsoft visual studio\vc98\include\xutility(96) :
error C2995: 'mismatch' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(520) : see declaration of
'mismatch'
c:\program files\microsoft visual studio\vc98\include\xutility(101) :
error C2995: 'swap' : template function has already been defined
c:\program files\microsoft visual
studio\vc98\include\stl\stl_algobase.h(90) : see declaration of 'swap'
Error executing cl.exe.

ChatServer.obj - 28 error(s), 0 warning(s)


I am not able understand all these..

Please help me out...
 
A

Alf P. Steinbach

* Prasad:
But , now I am getting a new list of errors...
c:\program files\microsoft visual studio\vc98\include\utility(27) :
error C2953: 'pair' : template class has already been defined

It seems you are mixing two different implementations of the standard
library.

Try to use just one of them.

For example the one bundled with your compiler.
 

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

Similar Threads

Compile Error using C++ VS6.0 using Notes API 3
key compare problem in stl map 10
works fine using gcc 2
map and visual C++ 5
atlconv.h header error.. 2
error C2061 14
Compiling in MSVC7 1
vector use warnings 1

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top