error LNK1181: cannot open input file ‘kernel32.lib’ – Fix


When I tried to complie a simple C++ program with VC++ express,  I got this error error:

LNK1181: cannot open input file ‘kernel32.lib’.

Fixing it took me some time so I decideed to share how I fixed it.


In my case the problem was : messed up SDK versions

1. First Download and Process monitor, a simple but powerful tool from Sysinternal that was bought my microsoft

2. Next  run it and add the follwing filters.

Process name is VCexpress.exe include

Result is path not found include.

see the picture to check how its supposed to look like.

Process Monitor 3. Now compile your C++ program again. and check the results again. you will see all the paths were VC express looked for and did not find kernel32.lib

I assume that kernel32.lib is already there soewhere in your computer. it is just that VC is looking for it in the wrong place, so do a computer wide search for kernel32.lib.

Once you find it, and it is supposed to inside an SDK folder \ lib. copy the entire lib folder to one of the locations that VC was checking for the file. in my case it was C:\Program Files\Microsoft SDKs\Windows\v6.0A  (the problem was that stupid VC was looking in C:\Program Files(86)\Microsoft SDKs\Windows\v6.0A)

4. Now compile again. It should work.

5. One last thing, hit the +1 button, and say thanks in the comments sections. then you are free to go code your eyeballs out in VC

Comments are closed.