Visual Studio创建C++控制台应用失败,报E1696错误求助
stdio.h, tchar.h, SDKDDKVer.h in C++ Console App Hey, I’ve run into this exact set of errors before when setting up C++ projects in Visual Studio—those E1696 missing header issues almost always tie back to problems with the Windows SDK or project path configurations. Let’s walk through some practical fixes to get your project up and running:
First, confirm the Windows SDK is installed
Those headers are core parts of the Windows SDK, which should come with Visual Studio, but sometimes it gets skipped during installation. Open the Visual Studio Installer, select your installed version of VS, click "Modify," then check under the "Individual components" tab that the Windows SDK matching your OS version is selected. Install it if it’s missing, then restart Visual Studio.Double-check your project’s include paths
Sometimes the project doesn’t point to the right SDK directories. Right-click your project in Solution Explorer, go toProperties > VC++ Directories > Include Directories. Make sure the path to the Windows SDK’s include folders is listed—you should see entries likeC:\Program Files (x86)\Windows Kits\10\Include\[your SDK version]\umandC:\Program Files (x86)\Windows Kits\10\Include\[your SDK version]\shared(whereSDKDDKVer.hlives). If they’re missing, add them manually, or use the "Edit" button to let VS auto-populate the correct paths.Reset Visual Studio settings to default
Corrupted settings can mess up path configurations without you noticing. Head toTools > Import and Export Settings > Reset all settings, follow the wizard to reset to the default profile. This often clears up wonky path issues that cause header lookup failures.Repair your Visual Studio installation
If none of the above works, there might be damaged or missing files in your VS setup. Go back to the Visual Studio Installer, select your VS version, click "Modify > Repair." This will scan and fix any broken components related to the compiler, SDK, or project templates.Ensure you’re using the correct project template
Double-check that you created a Windows Console Application (not a cross-platform, Linux, or other non-Windows template). Some alternative templates don’t include the Windows SDK paths by default, which would lead to these missing header errors. If you picked the wrong template, start fresh with the correct one.
内容的提问来源于stack exchange,提问作者user9406575

