How do I fix the linker error in project upgraded from VS2010 to VS2013 where the linker is looking for an MFC library file that is not present?

感情迁移 提交于 2019-12-23 12:03:41

问题


I am upgrading a VS2010 project to VS2013. One of my applications is looking for mfc120.lib (or mfc120d.lib for debug builds). However, it appears that VS2013 ships with mfc120*u*.lib and mfc120*u*d.lib (presumably unicode versions which is the only version of MFC supported by VS2013).

Here are the linker errors I'm getting:

LINK : fatal error LNK1104: cannot open file 'mfc120.lib'
LINK : fatal error LNK1104: cannot open file 'mfc120d.lib'

I'm looking through the project property sheets and don't see any setting for specifying which MFC library file to link against. It's not even showing up in the "Linker-->Command Line" page of the property sheets.

Can someone help me figure out how to get the project to link to the correct library files?

Thank you very, very much!


回答1:


In your compile commandline, there is probably a

/D "_MBCS"

and that should be

/D "_UNICODE"

That's effectively like putting a

#define _UNICODE

at the top of your source files, but I think it affects what libraries are pulled in well.

See the MSDN docs for more info.




回答2:


Sometimes the issue involves code that can't be re-compiled with Unicode support. In that case, download the multi-byte libraries:

http://www.microsoft.com/en-us/download/details.aspx?id=40770




回答3:


In VS2013, these are available as addon:

http://msdn.microsoft.com/en-us/library/dn251007.aspx



来源:https://stackoverflow.com/questions/19602392/how-do-i-fix-the-linker-error-in-project-upgraded-from-vs2010-to-vs2013-where-th

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!