Aditya Kaushik
Aditya Kaushik

Reputation: 213

LINK : fatal error LNK1181: cannot open input file

I was attempting to compile a VC6 project at work , with VS2008 . I was able to successfully remove all compilation errors and warnings in my legacy code.

But I am facing a peculiar problem during the linking phase . The problem is as follows :

The first issue I faced was that there was an error related to mfc42d.obj not being found. To circumvent this , I placed the VC6 libraries inside my VS9 installation. ( in a folder called VC6Lib).

Now when I attempt to recompile the project , it gives an error saying : LINK : fatal error LNK1181: cannot open input file 'C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\lib\VC6Lib.obj'

The build log's header is attached for your reference below :

cl /Ox /I "C:\Program Files\Microsoft Visual Studio 9.0\VC\include" /I "D:\Simulator\simserver\h" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WINVER=0x0601" /D "_WIN32_WINNT=0x0601" /D "_CRT_SECURE_NO_WARNINGS" /D "USE_MSXML_NAMESPACE" /D "_AFXDLL" /D "_ATL_STATIC_REGISTRY" /D "_MBCS" /FD /EHa /MD /Zc:wchar_t- /Fo"Release\" /Fd"Release\vc90.pdb" /W4 /c /Zi /clr /TP .\simserver\src\structdb.cpp 1> .\simclient\src\stdafx.cpp

I've scraped through all other StackOverflow and MSDN threads on this error and have seen nothing related to a problem like mine , and there are no spaces in any directory name in the linker settings [ which is mentioned as the source for this issue everywhere].

I would like to know what type of an error this may be and what can the possible solution be for the same.

Upvotes: 2

Views: 4702

Answers (2)

RC Brand
RC Brand

Reputation: 437

Now when I attempt to recompile the project , it gives an error saying : LINK : fatal error LNK1181: cannot open input file 'C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\lib\VC6Lib.obj' --- Check if you really has this file there. you get this when you reference a lib in the project and when VS tries to look for it, it not present there.

Upvotes: 1

harper
harper

Reputation: 13690

mfc42d.lib is the import library of the old MFC. You must remove that library from the list of librariers to link. You add the correct MFC library using the projects settings "Use as static/shared library.

Upvotes: 1

Related Questions