Compiler Error C2872 产生错误的研究

公司里的一个程序,出现了Compiler Error C2872 错误,怎么调试也不行。从网上找来了一部分资料,

先可以看看MSDN的解释:

'symbol' : ambiguous symbol

The compiler could not determine which symbol you are referring to.

The following code shows an example of this error.

namespace A { int i; } using namespace A; int i; void z() { ::i++; // ok A::i++; // ok i++; // error C2872, ::i or A::i? }
意思好象是命名空间出了问题。网上有一个例子:

    

EXAMPLE 2: The following sample causes compiler error C2872 'symbol' : ambiguous symbol

	//Compile options: /GX
	#pragma warning (disable : 4786)

	#include &ltiostream.h> #include &ltiostream>

	using namespace std ;

	int main()
	{
		cout << "Hello World" << endl ; //C2872 here
		return 0 ;
	}

To workaround this problem, remove the using namespace directive. If you remove the using directive the cout from the old iostream is used. To use cout from the Standard C++ Library use fully qualified names for example, std::cout.

你可能感兴趣的:(C++,c,library,iostream,compiler)