Cannot open file 'kernel32.lib'

Hello, the course i’m learning from: Unreal Engine C++ Developer: Learn C++ and Make Video Games

This problem is what I encounter when I try to compile with cl triplex.cpp when following video #14 at 5:18.

Things I have tried.

  1. Reinstall Visual Studio 2019 and Visual Studio Code. I did this 3 times, nothing changes.

  2. Double Checking to see if I downloaded all the things the video suggested.

  3. Changing Enviromental Variables to the folder where Kernel32.lib exists.

Note: This is my 2nd time going over unreal engine c++ course. The first time, I did not encounter this problem. Somewhere along the line I decided to learn a C++ course before finishing the course and it had me change the environmental variables path in order to be able to use a different IDE call codelite for my C++ course. Maybe this is what’s causing this problem?

  1. Deleting the Folders with Kernel32.lib and reinstalling Visual Studio 2019 and VS Code.

I have spent 5 days trying to solve this problem on my own but to no avail. Any help is appreciated.

Do you get the same issue using the “Native Tools” command prompt instead?

I’m not sure what you are referring to when you say “Native Tools”. Could you elaborate? Thanks!

Search for it in the Windows Start Menu.

So I launched VS Code with both x64 and x86 native tool command prompt and ran a “cl triplex.cpp” on both and they have the same issue.

Hi Pachesan, did you add the Microsoft C/C++ extension to Visual Studio Code as Ben explains in lesson n. 8? Configure Visual Studio Code for Microsoft C++

Yes, it is installed.

Could you try going into the Visual Studio Installer and removing the Windows 10 SDK and then re-installing it, or trying a different version of it?

You did the most logical steps to solve the problem, so if the cause was a common one you would’ve already solved this out. Seems like what you’re pointing out here is a good candidate to be the culprit, but because you already tried to handle this issue by editing the environment variables, I would once again start from the beginning;
Microsoft dedicates an entire section to Error LNK1104 and when it comes to kernel323.lib it states:
“If the file that can’t be opened is one of the standard library files provided by Microsoft, such as kernel32.lib , you may have a project configuration error or an installation error. Verify the Windows SDK has been installed. If your project requires other Microsoft libraries, such as MFC, make sure the MFC components were also installed by the Visual Studio installer. You can run the installer again to add optional components at any time.”
I see you have the latest SDK installed and it already contains all API from previous versions, still what @DanM suggests seems the right thing to do, so I would try experimenting with SDK too.

@DanM , I tried all Versions and and i’m still getting the kernel32.lib problem.

I don’t know what else to do. All I just want to do is learn to make a game in C++ lol

@Arilal Thanks, this looks promising, i’ll take a look and see if I can find anything that can help.

1 Like

Are you able to use Visual Studio successfully (not VS Code). In Visual Studio create a C++ Console Application project.

If that does work you should be able to go back to Code if you prefer for the Unreal sections as you wouldn’t be invoking the compiler yourself.

1 Like

@DanM I booted up VS 2019 just now. It seems like it was able to run a simple hello world console app.

I’ll give this a try!

Update: 10/20/21
For anyone on PC with the same issue, I suggest you try out Visual Studio 2019, it works just fine. You will have to learn some extra stuff, such as the layout, where things are, etc

This will be the perfect video for it as it helped me: C++ FOR BEGINNERS (2020) - First program “Hello World” using Visual Studio 2019 PROGRAMMING TUTORIAL - YouTube

Good luck!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms