error cannot open file 'kernel32.lib'

Harry Boy picture Harry Boy · Sep 15, 2016 · Viewed 53.1k times · Source

I have installed VS2013 and VS2015 on Windows 7.

I have an existing C++ Dll project that was building fine but now all of a sudden it wont build using VS2015 and gives me the error:

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

From this post: fatal error LNK1104: cannot open file 'kernel32.lib' I went looking for the kernel32.lib file and it is located here:

C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86

When I go to my Projects Properties-->Linker-->Input and select Macros I see that this path is indeed there:

enter image description here

My Platform Toolset is set to Visual Studio 2013 - Windows XP (v120_xp) which is what it always has been set to.

Why has my Project all of a sudden stopped building? What could have gone wrong?

Answer

João Luis picture João Luis · Aug 9, 2017

I had this similar problem today with Visual Studio 2013 when I changed my VC++ Directories:

Project->Properties->VC++ Directories: Include Directories