views:

32

answers:

2

I have migrated my VC6 application to VS2005, all my code got compiled with some changes and there is no compilation error. But I am getting a linking error LNK1104. LINK : fatal error LNK1104: cannot open file 'mfc42u.lib'

I have imported the dsw of VC6 in Visual Studio 2005, not sure from where it is still referring to the mfc42u.lib (I assume its library of VC6).

Please guide me how to get rid of this error.

A: 

This library is referred from Linker section of your project settings, specifically "Additional libraries" or something like this (do not remember the name of the setting exactly) - there are libraries needed to be linked with listed there. So just replace the mfc42u.lib with mfc8u.lib or whatever is the relevant version of mfc installed with your VS distribution there.

justadreamer
You shouldn't need to specify the MFC static library explicitly anyway - if you just set the project to use MFC static library it should pick up the appropriate one automatically. My advice would be to just remove the explicit reference.
Steve Folly
I could not find where I am explicitly referencing the mfc42u.lib file, I checked all the location in the project properties.Following are the options in "Command Line" of "Linker"/OUT:"ReleaseU/HAB.dll" /INCREMENTAL:NO /NOLOGO /DLL /MANIFEST /MANIFESTFILE:".\ReleaseU\HAB.dll.intermediate.manifest" /DEF:".\HAB.def" /DELAYLOAD:"OleAcc.dll" /DEBUG /PDB:"ReleaseU/HAB.pdb" /MAP:".\ReleaseU/HAB.map" /SUBSYSTEM:WINDOWS /BASE:"0x6800000" /IMPLIB:"ReleaseU/HAB.lib" /MACHINE:X86 /ERRORREPORT:PROMPT
GJ
It may not be referenced in the project settings but in `stdafx.h` (or one of its includes, `afx*.h`) using a `#pragma` statement.
Praetorian
A: 

probably your linker settings aren't set properly. Go to Project Settings->Configuration->General->Use MFC Libraries and make sure the value is set to 'Use MFC in a shared library'. If you are able to build properly, then you can change it back to 'Static' to use the new library.

ivymike