error LNK1104: cannot open file 'mfc90.lib'

2020-03-31 08:53发布

问题:

I'm working with Visual Studio 2012 Professional, and my project reference static library built with VS2008(v90). When I build with VS2012(v110),

error LNK1104: cannot open file 'mfc90.lib'

error occurs.
Is it the only way to fix this problem to change platform toolsets? I think it is not a solution to me since I should target .NET Framework 4.5. (I know I cannot use .NET Framework 4.0 with v90. If it is wrong, correct me)
Please let me know how to use library built with VS2008 in VS2012 project.
Thanks in advance!

ps. If changing platform toolsets is the only way to solve the problem, how can reference multiple libraries built with various visual studio compiler?(for example, built with vs2008, vs2010, and vs2012)

EDIT: I'm writing a wrapper program for 3rd party library(Native C++) to run on .NET Framework. The problem is I should build with VS2012, but the library built with VS2008 and it needs mfc90.lib (which is not included in VS2012)

回答1:

I was able to get my projects to build in vs2012 (converting from vs2008) by linkinking to mfc110.lib instead of mfc90.lib



回答2:

I don't think the MFC library has anything to do with the .NET Framework version you target. VS2012 will have something like mfc110.lib, which is probably what you should use. If you want to use mfc90.lib, it should be in the following folder:

C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\lib

Of course you need to have VS2008 installed for this folder to exist.

But VS2012 won't look in that folder for library dependencies, so you need to specify the full path in Configuration Properties | Linker | Input | Additional Dependencies.