This documentation is archived and is not being maintained.

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;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?