Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2872

'symbol' : ambiguous symbol

The compiler cannot determine which symbol you are referring to.

C2872 can occur if a header file includes a using Directive (C++), and a subsequent header file is #include'd and contains a type that is also in the namespace specified in the using directive. Specify a using directive only after all your header files are specified with #include.

For more information about C2872, see http://support.microsoft.com/default.aspx?scid=kb;en-us;316317.

The following sample generates C2872:

// C2872.cpp
namespace A {
   int i;

using namespace A;
int i;
int main() {
   ::i++;   // ok
   A::i++;   // ok
   i++;   // C2872 ::i or A::i?

Community Additions

© 2015 Microsoft