MTisza

I have a project that will build fine if I'm in VC++2005 and click on build, but fails with the following error if I try to build it with msbuild:

LINK : fatal error LNK1104: cannot open file 'user32.lib'

I looked at the buildlog.htm file and notice a significant difference in that in the buildlog when it fails there are extra lib files appended to the command line:

user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
 
The user32.lib is what MSBuild complains about.
 
I'm using a vcproj file that was generated with VC++2005IDE.
 
I'm a real noob so I could use some help.
 
Thanks.
 


Re: Visual Studio MSBuild MSBuild gives LINK : fatal error LNK1104: cannot open file 'user32.lib'

Neil Enns MSFT

What happens if you build using vcbuild.exe on the command line instead of MSBuild If you're just building a VC++ project and nothing else there is no advantage to using MSBuild.

Neil






Re: Visual Studio MSBuild MSBuild gives LINK : fatal error LNK1104: cannot open file 'user32.lib'

JosefM

I have exactly the same problem, also many libraries should be linked but are not found.

In my case it fails with library "odbc32.lib".

The problem occurs in the same way both with "msbuild" and  "vcbuild".

I searched

- the complete registry,

- my "domuments" folder,

- the "program folder",

- the system environments

-the output of the "set" command both in a "cmd" window and in a "Visual Studio 2005 Command Prompt"

But I could not find the string "odbc32.lib" in any of those files.

 

The MSBUILD log file contains the following line:

 /OUT:".\..\..\Results\pdb\English\WinRelease/enabjena.dll" /INCREMENTAL:NO /LIBPATH:"H:\enabler\MySource\External\OpenSSL\windows" /LIBPATH:"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib" /LIBPATH:"C:\WINDOWS\system32" /LIBPATH:"..\External\OpenSSL\windows" /DLL /MANIFEST /MANIFESTFILE:".\..\..\Results\EnaTmp\pdb\obj\English\WinRelease\enabjena.dll.intermediate.manifest" /PDB:".\..\..\Results\pdb\English\WinRelease/enabjena.pdb" /IMPLIB:".\..\..\Results\pdb\English\WinRelease/enabjena.lib" /MACHINE:X86 wsock32.lib mpr.lib ssleay32.lib libeay32.lib netapi32.lib mpr.lib wsock32.lib User32.lib version.lib advapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

The last 15 libs are not needed, they occur in no file like *.sln or *vcproj, ...

Where do they come from

Please let me know any places where I can search.

Thanks





Re: Visual Studio MSBuild MSBuild gives LINK : fatal error LNK1104: cannot open file 'user32.lib'

Tim Mawr

I had the same problem. Here's how I solved it:

Press Alt+F7 to open Project Properties, then select Configuration Properties > Linker > Input > Additional Dependencies, now delete the offending files.