2012-04-09 102 views
1

我正在使用Visual Studio 2010来处理C++代码。该项目及其所有内容均由其他人撰写,并复制到共享驱动器上。当创建者在他的电脑上构建它时,它可以正常工作。当我尝试构建解决方案,我得到了一大堆这些错误的什么会在一台计算机上导致模糊符号错误,而不是另一台计算机上?

error C2872: '<lambda0>' : ambiguous symbol could be 
'[File].cpp(66) : anonymous-namespace'::<lambda0>' or 
'[Different file].h(549) : `anonymous-namespace'::<lambda0>'. 

这里的据说是在错误行的一个示例:

std::pair<int, std::pair<int, Point>> b) -> bool { return (a.second.second < b.second.second); }); 

好像总是错误以'});'结尾的一行出现。完整的代码在这里显示的内容相当庞大,而且可以在其他计算机上运行,​​所以推测这是我的设置或其他问题。任何人都可能猜测他们可能是什么?

+0

检查ANSI代码页。 – Joshua 2012-04-09 20:16:36

+1

你的编译器是否支持C++ 11? – juanchopanza 2012-04-09 20:20:17

+2

VS的相同补丁级别? – 0xC0000022L 2012-04-09 20:36:14

回答

2

不知道,如果你已经看到了这个或没有,但根据该编译器错误MSDN页:

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.

MSDN Page

0

我也有同样的问题枝条暧昧的符号问题。对我来说,事实证明我使用了两个具有相同功能但明显不同定义的命名空间。我不得不停止使用其中一个命名空间,这就解决了这个问题。

举个例子:

using namespace cv; 
using namespace boost::accumulator; 
accumulator_set<double, stats<tag::mean, tag::variance> > acc; 
double meanval = mean (acc); 

这将通过编译错误:error C2872: 'mean' : ambiguous symbol这是因为这两个品种的命名空间和boost ::蓄电池具有相同的功能“的意思是”

我希望这有助于

相关问题