Cannot open include file: 'stdio.h' - Visual Studio Community 2017 - C++ Error
I got same problem with a project porting from Visual Studio 2013 to Visual Studio 2017.
Fix: change Properties → General → Windows SDK Version to 10
Faced the problem of missing stdlib.h
and stdio.h
(and maybe more) after installing VS2017 Community on a new computer and migrating a solution from VS2013 to VS2017.
Used @Maxim Akristiniy's proposal, but still got error message regarding toolset compatibility. However VS itself suggested to do solution retarget by right-clicking on the solution in Solution Explorer, then selecting Retarget solution
from the menu and the updated Windows SDK Version
from the drop-down list.
Now my projects build w/o a problem.
Note that you may need to make the project your startup project for the retargeting to catch.
There are three ways to solve this issue.
- Ignore Precompiled Headers #1
Steps: Project > Properties > Configuration Properties > C/C++ > Command Line > in the Additional Options box add /Y-. (Screenshot of Property Pages) > Ok > Remove#include "stdafx.h"
- Ignore Precompiled Headers #2
Steps: File > New > Project > ... > In the Application Wizard Window click Next > Uncheck the Precompiled Header box > Finish > Remove#include "stdafx.h"
Reinstall Visual Studio
This also worked for me, because I realized that maybe there was something wrong with my Windows SDK. I was using Windows 10, but with Windows SDK 8.1. You may have this problem as well.
Steps: Open Visual Studio Installer > Click on the three-lined Menu Bar > Uninstall > Restart your computer > Open Visual Studio Installer > Install what you want, but make sure you install only the latest Windows SDK 10, not multiple ones nor the 8.1.The first time I installed Visual Studio, I would get an error stating that I needed to install Windows SDK 8.1. So I did, through Visual Studio Installer's Modify option. Perhaps this was a problem because I was installed it after Visual Studio was already installed, or because I needed SDK 10 instead. Just to be safe I did a complete reinstall.
For CUDA:
Right Click on your project.
Go to Properties->CUDA and set "CUDA Toolkit Custom Dir" to your CUDA toolkit directory.
For me it was: C:\\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0