468,758 Members | 2,065 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

error C2872: 'streambuf' : ambiguous symbol Problem

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

Jun 9 '06 #1
9 12215
Prasad wrote:
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
is no *standard* header <hash_map>, but some old sources might be written
to use old pre-standard headers like 'istream.h' (which looks like one).
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....
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).
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 9 '06 #2
* 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.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jun 9 '06 #3
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
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".


Ya the two headers I am using are "no.h " files only..
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


Jun 9 '06 #4
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
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".


Ya the two headers I am using are "no.h " files only..
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


Jun 9 '06 #5
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
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".


Ya the two headers I am using are "no.h " files only..
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


Jun 9 '06 #6
HI Alf P. Steinbach ,
Thanx for ur reply,
Alf P. Steinbach wrote:
* 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>


Yes , I am using <iostraem> only..
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: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Jun 9 '06 #7
* 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.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jun 9 '06 #8

Alf P. Steinbach wrote:
* 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::output_iterator_tag,void,void>' :
base class undefined
c:\program files\microsoft visual
studio\vc98\include\utility(318) : see reference to class template
instantiation 'std::ostreambuf_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...

Jun 10 '06 #9
* 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.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jun 10 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by rodri rodri via DotNetMonster.com | last post: by
1 post views Thread by bor_kev | last post: by
1 post views Thread by Simon Jefferies | last post: by
1 post views Thread by Rick | last post: by
4 posts views Thread by davidk13 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.