Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,178 Views

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

Has anyone debugged this "kernel32.lib" issue with Intel Parallel Studio XE 2018 and Visual Studio 2017? This showed up in past posts for earlier software versions, but the suggestions do not seem to apply directly to the new versions. We just installed the Visual Studio extensions to get SDK's. Please let me know how to verify that we have installed enough through Visual Studio and how to get the Intel Fortran compiler to recognize these libraries from the command shell.

0 Kudos
2 Replies
Highlighted
Black Belt Retired Employee
1,178 Views

kernel32.lib is THE fundamental Windows API library. It is found in the Windows SDK and the default set of library locations should include it. But I have sometimes seen that separate installations of the Windows SDK messes up the environment variables Visual Studio uses to locate these.

The first thing I would suggest is, in Visual Studio, go to Tools > Options > Intel Compilers and Tools > Visual Fortran > Compilers. Click the Reset... button, then switch to the x64 tab and click the Reset... button there.  Go back to the Win32 tab, then click on the ... button to the right of Libraries. You should see a list that looks like this:

$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\lib\x86
$(UniversalCRTSdkDir)Lib\$(UCRTVersion)\um\x86
$(UniversalCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x86
$(IFortInstallDir)compiler\lib\ia32_win
$(IFortInstallDir)mkl\lib\ia32_win
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\atlmfc\lib\x86
$(WindowsSdkDir)lib\winv6.3\um\x86
$(FrameworkSDKDir)lib

If this doesn't help. find the latest folder containing kernel32.lib (on my system it is C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x86 for Win32) and add that path explicitly at the end of the Libraries list. You really shouldn't have to do this, though.)

0 Kudos
Highlighted
Beginner
1,178 Views

Thank you for the advice. My library list was nearly identical to yours. The fix to the problem seemed to be adding both the "um" library path and the "ucrt" library path. This allowed the linker to find all of the needed libraries.

Thank you!

0 Kudos