Get the App
SLTechnology News&Howtos  ›  Servers  › 

VS2013 can't find a solution for winres.h.

Shulou Source: shulou.com Published: 2022-06-02 07:47:01 09月16日 Update

I haven't done C++ for a long time. C++ is the most annoying way to report mistakes in various versions. I am not very familiar with C++ project development, because the project needs to use VS2013 to modify a C++/MFC project, a compilation error can not open the include file: "winres.h": No such file or directory.

I checked on the Internet and found that this' winres.h' is a header file of Windows SDK. Open the C disk and look for it. As expected, it is under the Windows SDK directory C:\ Program Files (x86)\ Microsoft SDKs\ Windows\ v7.1A\ Include.

If I guess correctly, then the reason should be very simple, that is, the project project does not refer to Windows SDK.

Open the Microsoft.Cpp.Win32.user.props under C:\ Users\ Administrator\ AppData\ Local\ Microsoft\ MSBuild\ v4.0\ to configure the default Include and Lib files for the VC project. If you open it, you can see that there is clearly $(WindowsSdkDir) include in it, that is to say, VS2013 has a configured Windows SDK path by default, so why can't you find this winres.h?

Open the registry HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ MicrosoftSDKs\ Windows\ CurrentVersion and CurrentInstallFolder to have a look

The default environment variable WindowsSdkDir points to the directory of WindowsSdk. Yes, what's going on? Check the Internet again and finally understand what's going on. SDK under C:\ Program Files (x86)\ Microsoft SDKs\ Windows\ v7.1A is the old version of WindowsSDK, and the latest WindowsSDK is installed under C:\ Program Files (x86)\ Windows Kits\ 8.0\ Include. And the default environment variable used by VS2013 is $(WindowsSDK_IncludePath), which contains the next three header file directories of the latest WindowsSDK:

C:\ Program Files (x86)\ Windows Kits\ 8.0\ Include\ um

C:\ Program Files (x86)\ Windows Kits\ 8.0\ Include\ shared

C:\ Program Files (x86)\ Windows Kits\ 8.0\ Include\ winrt

In addition, $(WindowsSDK_LibraryPath_x86) points to the Lib file directory of the new SDK.

The final solution should be that the old version of the $(WindowsSdkDir) directory should be discarded and the new version of the environment variable should be replaced with the old one. Open C:\ Users\ Administrator\ AppData\ Local\ Microsoft\ MSBuild\ v4.0\ Microsoft.Cpp.Win32.user.props and modify it as follows:

Delete $(WindowsSdkDir) include and $(WindowsSdkDir) lib in the red circle, and add $(WindowsSDK_IncludePath) and $(WindowsSDK_LibraryPath_x86).

VC++ development related new environment variables:

1. VC_LibraryPath_x64 = D:\ Program Files (x86)\ Microsoft Visual Studio 12.0\ VC\ lib\ amd64;D:\ Program Files (x86)\ Microsoft Visual Studio 12.0\ VC\ atlmfc\ lib\ amd64

2. VC_LibraryPath_x86 = D:\ Program Files (x86)\ Microsoft Visual Studio 12.0\ VC\ lib;D:\ Program Files (x86)\ Microsoft Visual Studio 12.0\ VC\ atlmfc\ lib

3. WindowsSDK_IncludePath = C:\ Program Files (x86)\ Windows Kits\ 8.1\ Include\ shared;C:\ Program Files (x86)\ Windows Kits\ 8.1\ Include\ um;C:\ Program Files (x86)\ Windows Kits\ 8.1\ Include\ winrt

4. WindowsSDK_LibraryPath_x64 = C:\ Program Files (x86)\ Windows Kits\ 8.1\ Lib\ winv6.3\ um\ x64

5. WindowsSDK_LibraryPath_x86 = C:\ Program Files (x86)\ Windows Kits\ 8.1\ Lib\ winv6.3\ um\ x86

Tags: Variable environment file directory project version Category head that is project point development configuration method following figure reason that is I guess method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS MariaDB vpn Huawei