Export (0) Print
Expand All
Expand Minimize

Compiler Error C2872

Error Message

'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

ADD
Show:
© 2014 Microsoft