Share via


LNK1104: cannot open file 'mfc42.lib'_

Question

Saturday, July 4, 2009 5:18 PM

Hi,
I am converting a project from VS6.0 to VS2008
I am getting the error
Error    644    fatal error LNK1104: cannot open file 'mfc42.lib'    Appframe    Appframe

1] as I want to use the new version of MFC library, why it is linking to old MFC
2] How to force to link to new MFC lib
3] any other comments, solutions welcome

All replies (6)

Saturday, July 4, 2009 6:04 PM ✅Answered

Watch out for .lib files that might have been compiled with the old version of MFC.  Desperation move: Project + Properties, Linker, Input, Ignore Specific Library = mfc42.lib
Hans Passant.


Monday, July 6, 2009 10:24 AM ✅Answered

Hello,

Please open your .rc file and delete the MANIFEST section, or Project Properties | Linker | Manifest File | Generate Manifest -> No
to see if it works.

Sincerely,
WesleyPlease mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Saturday, July 4, 2009 5:50 PM

Project + Properties, Linker, Input, Additional Dependencies.  Make sure mfc42.lib is not present there.   Next, search your code for #pragma comment.Hans Passant.


Saturday, July 4, 2009 6:00 PM

Project + Properties, Linker, Input, Additional Dependencies.  Make sure mfc42.lib is not present there.
=> No reference to MFC42

search your code for #pragma comment.
=> only pragma once, warning message  used

any solution?


Saturday, July 4, 2009 6:19 PM

after ignoring the mfc42.lib and mfcs42.lib I am getting following errors

Error    2    fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt    Appframe    Appframe
Error    3    fatal error CVT1100: duplicate resource.  type:MANIFEST, name:1, language:0x0409    CVTRES    Appframe

is there any inter connection in ignoring libs abd these error?
any solution to these errors


Friday, September 17, 2010 6:41 AM

I was able to resolve this issue as follows:

1) You'll need to have a copy of Visual Studio 6.0 or a copy of the Visual Studio 6.0\VC98\MFC\Lib directory.

2) Tools -> Options

a. If you don't see Projects and Solutions, check Show all Settings

b. Click Projects and Solutions.

c. Click VC++ Directories

d. Show directories for: Library Files

3) Add the path to your Visual Studio 6.0\VC98\MFC\Lib directory.

This will allow you to link to VC6.0 library items.

You should be able to have VS6.0 installed along side VS2008 or just have a copy of the files somewhere on your system.

NOTE: If you get errors regarding not having old v6.0 dlls on workstations that you deploy the app to, you have the option of installing them on the workstations or compiling your application to use static linking rather than dynamic linking.  Though dynamic linking is recommended, since your dlls no longer come with the OS, static linking may be easier than trying to distribute dll files with your exe.  To configure static linking:

Project -> Properties -> C/C++ -> Code Generation -> RunTimeLibrary set to either Multi-threaded or Multi-threaded Debug rather than multi-threaded dll.