C,C++
VS LNK1104: 'kernel32.lib' 파일을 열 수 없습니다.
jω
2021. 11. 25. 12:51
VS2010이 설치되어 있고, VS2019가 설치된 상황에서 어느버전의 VS든 Win32 (x86)으로 개발하려 하니,
LNK1104: 'kernel32.lib' 파일을 열 수 없습니다. 에러가 났습니다.
확인할수 있는 방법은 C++ Console App 으로 새로운 프로젝트를 만들어 오류없이 컴파일되는지 확인해보면 됩니다.
확인 이후 LNK1104 에러가 난다면 아래와 같이 따라하십시오.
C:\Users\user\AppData\Local\Microsoft\MSBuild\v4.0
* 여기서 user는 본인 컴퓨터 이름입니다. 다를 수 있으며, 다를 경우 본인의 설정된 경로대로 들어가주세요
Microsoft.Cpp.Win32.user.props 파일을 notepad, notepad++ 등 editor로 열어주세요.
저의 경우
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;C:\Program Files (x86)\BCGSoft\BCGControlBarPro\BCGCBPro</IncludePath>
<LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;C:\Program Files (x86)\BCGSoft\BCGControlBarPro\bin</LibraryPath>
<PublicModuleDirectories>$(PublicModuleDirectories)</PublicModuleDirectories>
</PropertyGroup>
</Project>
와 같이 되어있었습니다.
아래의 IncludePath 와 LibraryPath를 추가해주세요.
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
저의 경우 아래와 같이 되었습니다.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;C:\Program Files (x86)\BCGSoft\BCGControlBarPro\BCGCBPro;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;C:\Program Files (x86)\BCGSoft\BCGControlBarPro\bin;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
<PublicModuleDirectories>$(PublicModuleDirectories)</PublicModuleDirectories>
</PropertyGroup>
</Project>
순수한 Path 는 아래와 같습니다.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
</PropertyGroup>
</Project>
이후 프로그램을 재시작하여 오류없이 컴파일되는지 확인하시면 됩니다.
끝.