简体   繁体   中英

fatal error LNK1104: cannot open file 'kernel32.lib' in Visual Studio 2019

I'm using Visual Studio 2019 and I got an error even my PATH has kernel32.lib path.

 C:\Users\googi\Desktop\CMakeProject2\out\build\x64-debug\CMakeProject2\LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
ninja: build stopped: subcommand failed.

PATH...

c:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86

And if I try to run on Command Prompt, it says...

This file does not have an app associated with it for performing 
this action. Please install an app or, if one already installed,
create an association in the Defalt Apps Setting page.

I tried other these 3 paths but it gave me exact same errors.

C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm64
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64

About your case, I suggest you check these things below:

  1. Check if you have installed the Windows SDK for your version.

  2. Check if $(WindowsSdkDir)\lib is included in the directories list, if not, manually add it.

  3. Check if the value of WindowsSdkDir is correct.

在此处输入图像描述

sorry i couldn't comment but, turn on your internet connection and try to run your program and that file will download automatically.

It works for me, maybe it will work for you too

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM