Why is Visual Studio 2010 throwing this error using Boost 1.42.0?

I am trying to recompile an application that compiles fine with warning level 4 in visual studio 2005 and visual studio 2008. Since the errors (see below) come from std: tr1, I think there is a conflict, but I don’t know how to fix it. My first thought was to remove all references to boost, for example, but then I get an error that it cannot find the format method. So, here is one of the mistakes: (not sure what that means) Any ideas, suggestions, solutions? Thanks!

EDIT: at the beginning I see the message: Unknown version of the compiler - run configure tests and report the results

EDIT2: a piece of code that seems to cause this error: (changed to protect the innocent) EDIT3: I updated the error message by adding even more. However, I get a lot of error messages like this one. Also there is a big problem / problem.

!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> ] 
+4
source share
2 answers

The problem is with visual studio 2010, or should I say that with additional templates that were added in visual studio 2010 tr1, then std :: make_pair does not always work. changed to a couple <> and all errors magically disappeared.

therefore, if you have problems with templates in VC2010 and using std: make_pair, change it to a pair <> and specify the template parameters.

+8
source

It looks like Visual Studio can do what you don't know. I think you can use the Microsoft compiler with the code :: blocks IDE. You can try each compiler (VS 2005/2008/2010). Also, try the difference with your source code repository to make sure that Microsoft has not “exceeded” your code.

Note. You do not need to use Code :: Blocks after finding out the problem. This can be a good tool for this particular problem.

-5
source

Source: https://habr.com/ru/post/1307685/


All Articles