LNK2022 and LNK2034 linker errors with version 10.0 of the CRT

前端 未结 5 2028
我寻月下人不归
我寻月下人不归 2021-01-05 09:34

Sorry to bother anyone with this question, but I\'ve been researching this for hours, with no resolution yet:

I am porting a rather massive application to the 10.0 C

5条回答
  •  有刺的猬
    2021-01-05 09:49

    I recently migrated a VS2008 project to VS2012 that included a C++/cli project and experienced these errors. I'm pretty anal retentive when it comes to my project/build files so I setup some custom .props msbuild files that the projects all import from (to avoid all the repeated and Condition riddled elements in the msbuild XML).

    So pretend the project was Example.vcxproj. and near the start I had this:

    
    
      DynamicLibrary
      v110_xp
      Unicode
      true
      <-- Including this here fixed my linker problems -->
      
    
    ...
    
    ...
    
    

    I had my FileWithCommonSettings.props file (where I have -TargetFrameworkVersion- defined) being included -after- Microsoft.Cpp.props. I instead opted to try setting -TargetFrameworkVersion- before Cpp.props, as you can see in the commented out XML. Doing this fixed all the linker issues I was getting. My guess is that Cpp.Default.props defaults to v4.0 in VS2010 and later.

    Hope this helps

    edit: Refering to this social.msdn thread, it would appear you need to use VS2010 (ie, toolset v100) in order to actually target v3.5. I didn't realize I was silently targeting 4.0 still with vc110...but it was only after I added that -TargetFrameworkVersion- element did I get rid of the linker errors. After switching to vc100 toolset the linker errors came back.

提交回复
热议问题