我正在尝试重新编译应用程序,该应用程序在 Visual Studio 2005 和 Visual Studio 2008 中编译良好,警告级别 4。
由于错误(如下所示)来自 std:tr1,我认为存在一些冲突,但不确定如何修复。我的第一个想法是删除所有对 boost 的引用,例如,但随后我收到一个错误,指出它找不到格式方法。
所以这是错误之一:(不确定这意味着什么)
有什么想法、建议、解决方案吗?
谢谢!
编辑:在开始时我看到一条消息:未知编译器版本 - 请运行配置测试并报告结果
EDIT2:我认为导致此错误的代码片段:(更改以保护无辜者)
EDIT3:我更新了错误消息,即添加了更多..但是我收到了更多错误消息,例如这个..所以有一个更大的问题/问题。
!m_someMap.insert( std::make_pair( "somestring", SomeClass::isTrue ) ).second
....
.....
inline bool isTrue ( const IDog & dog ) { return s.IsDogTrue(); }
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(197): error C2752: 'std::tr1::_Remove_reference<_Ty>' : more than one partial specialization matches the template argument list
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtr1common(356): could be 'std::tr1::_Remove_reference<_Ty&&>'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtr1common(350): or 'std::tr1::_Remove_reference<_Ty&>'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(962) : see reference to class template instantiation 'std::tr1::remove_reference<_Ty>' being compiled
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(26) : see reference to class template instantiation 'std::tr1::decay<_Ty>' being compiled
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1> C:\(PATH)\...(915) : see reference to class template instantiation 'std::tr1::_Unrefwrap<_Type>' being compiled
1> with
1> [
1> _Type=bool (__cdecl &)(const IDog &)
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(965): error C2528: 'abstract declarator' : pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(349): error C2528: 'type' : pointer to reference is illegal
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(967) : see reference to class template instantiation 'std::tr1::add_pointer<_Ty>' being compiled
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(197): error C2752: 'std::tr1::_Remove_reference<_Ty>' : more than one partial specialization matches the template argument list
1> with
1> [
1> _Ty=bool (__cdecl &)(const char *,int,const char *,std::string &)
1> ]
问题出在 Visual Studio 2010 上,或者我应该说,使用添加到 Visual Studio 2010 tr1 中的附加模板,因此 std::make_pair 并不总是有效。更改为pair,所有错误都神奇地消失了。
所以,如果你在VC2010中使用std:make_pair时遇到模板问题,请将其更改为pair并指定模板参数。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)