4

I'm trying to recompile application, that compiles fine with warning level 4 in visual studio 2005 and visual studio 2008. Since the errors (look below) are coming from std:tr1, I'm thinking there's some conflict, but not sure how to fix. My first thought was to remove all references to boost, such as but then I get an error that it can't find format method. So here's one of the errors: (not sure what it means) Any ideas, suggestions, solutions? Thanks!

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

EDIT2: Piece of code that I think causes this error: (changed to protect the innocent) EDIT3: I updated the error message, i.e added more..however I get many more error messages such as this one..so there's a bigger problem/issue.

 !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>          ]
ra170
  • 3,643
  • 7
  • 38
  • 52
  • 3
    All the errors are being thrown from template instantiations. We need to see the code that's calling Boost in order to diagnose this. – Billy ONeal Apr 22 '10 at 14:30
  • I think I might have to build boost with visual studio 10, let me try that.. – ra170 Apr 22 '10 at 14:35
  • 2
    @ra170: No, the errors are being thrown during compilation. A lack of build would be a link time error. – Billy ONeal Apr 22 '10 at 14:37
  • @ra170: I have reconstructed your error message -- wordwrap that was installed because you used quote instead of code destroyed it to begin with -- and now it's clear the error message isn't complete either. We need the whole error message. – Billy ONeal Apr 22 '10 at 14:39
  • This says `std::tr1::_Remove_reference<_Ty&&>`. That's an rvalue reference. These are new in VS 2010. I'd very much doubt that they have the std lib wrong, as Billy said, so the errors are meaningless unless you provide the code that causes them. – sbi Apr 22 '10 at 14:41
  • How would `remove_reference` match ``? There is no way for that to work. The compiler message sounds weird. – Johannes Schaub - litb Apr 22 '10 at 14:55
  • @Johannes: Where are you getting `remove_reference`? I don't see that in the error message. Also, I believe the OP changed the error significantly -- I tried to recover the gist but I seriously doubt the OP's class is really `bool (__cdecl &)(const BlahBlah &)`. – Billy ONeal Apr 22 '10 at 15:06
  • @Billy it shows what `_Ty` is in the third line... :) – Johannes Schaub - litb Apr 22 '10 at 15:08
  • @Johannes: Yes, but it says `bool (__cdecl &)(const BlahBlah &) `, not `void(&)`. Hence my confusion. And again, I strongly suspect that's not the real error message. – Billy ONeal Apr 22 '10 at 15:20
  • AFAICT this is not a boost problem. You definitely need to post more information for you question to be answerable. – Edward Strange Apr 22 '10 at 15:46
  • @Billy i left out all that noise around the type. – Johannes Schaub - litb Apr 22 '10 at 16:04
  • Right at the beginning I get a message: Unknown compiler version - please run the configure tests and report the results so I tried recompiling w bjam like this: >bjam --toolset=msvc-10.0 --build-type=complete – ra170 Apr 22 '10 at 16:11
  • @Billy ONeal, of course it's not (__cdecl &)(const BlahBlah &), but it could be as well (__cdecl &)(const IDog &) - It's an interface... – ra170 Apr 22 '10 at 18:31
  • I'm finding VS2010 barfs on make_pair anytime the types are function pointers. Are there any solutions to this other than changing it to pair<>()? I have a lot of code that is not compiling because of this :( – marathon Sep 18 '11 at 01:42

2 Answers2

8

the problem is with visual studio 2010, or I should say that with additional templates that were added to visual studio 2010 tr1, so, std::make_pair, doesn't always work. changed to pair<> and all errors magically went away.

so, if you have template problems in VC2010 and using std:make_pair, change it to pair<> and specify template parameters.

ra170
  • 3,643
  • 7
  • 38
  • 52
-5

It sounds like Visual Studio might be doing something 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 a diff from your source code repository to be sure Microsoft didn't "prettify" your code.

Note: You don't have to use Code::Blocks after you figure out the problem. It just might be a good tool for this particular issue.

User1
  • 39,458
  • 69
  • 187
  • 265
  • 2
    -1: Does not answer the OP's question. Also, the errors are thrown by the compiler, not the IDE, meaning that the message is not going to change in Code::Blocks. EDIT: And Visual Studio does not "prettify" code. Even if it did, it should still compile. – Billy ONeal Apr 22 '10 at 15:03
  • 1
    +1: At least he pointed out what may be considered as a source of a problem – chester89 Apr 22 '10 at 15:09
  • @chester89: Where? The only advice I see there is "Don't use Visual Studio". – Billy ONeal Apr 22 '10 at 15:14
  • @Billy: How do you know the IDE didn't change the code before it was compiled to work around some compiler issue? How do you know that VS is calling the compiler with some strange additional options that you don't expect? Another IDE can rule out those issues. Finally, where did I say "Don't use Visual Studio"? Read my post again, I actually stated that he did not have to use code::blocks after the problem was solved. It's just a good troubleshooting tool. Do you work for Microsoft? – User1 Apr 22 '10 at 21:06