BrianK
BrianK

Reputation: 2705

can't find stdio.h in new Visual Studio 2017 Community project

I found questions for the issue I'm having, but none of the solutions worked for me. I'm asking a new question instead of adding a comment to an existing question. I developed in C++ years ago, but this is the first I have tried to build a c++ program on Windows 10 with VS 2017 Community edition.

I installed Visual Studio 2017 community edition and created a blank C++ console project. When I try to build I get

fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

I went back to the installer and the Windows 10 SDK is checked: Windows 10 SDK (10.0.16299.0) for Desktop C++

My VC include folder is set to: $(VC_IncludePath);$(WindowsSDK_IncludePath);

Which evaluates to: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\include C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\VS\include C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt C:\Program Files (x86)\Windows Kits\8.1\Include\um C:\Program Files (x86)\Windows Kits\8.1\Include\shared C:\Program Files (x86)\Windows Kits\8.1\Include\winrt

Where should stdio.h and the rest of the C and C++ standard includes be?

If I comment out stdio.h, and try to include I get 1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.11.25503\include\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory

If I comment out all includes, the linker can't find 'ucrtd.lib

In the project setup for Windows SKD, the project has 8.1. If I try to change it to 10, I get "The SDK version was not found".

If I right click on the solution and select "Retarget solution", the only choice is 8.1.

So my question is where should the headers be? This system does have older Visual studio's installed.

Upvotes: 1

Views: 8915

Answers (1)

Dexygen
Dexygen

Reputation: 12561

I had the same issue albeit instead trying to use Code Blocks instead of Visual Studio. I'm on Windows 10, so your mileage may vary, but here is the path where I found stdio.h:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt

If you too are on Windows 10, I guess what might change is the specific version number between \Include\ and \ucrt

I know this goes along the right path because now when building I get a different error to the effect of "Cannot open file LIBCMT.lib". The location though is back under Visual Studio, specifically:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x86

So maybe the issue won't crop up with Visual Studio IDE, but, despite finding LINK: fatal error LNK 1104: cannot open file 'LIBCMT.lib' and trying a couple of the suggested solutions, I'm still struggling, and intend to open a similar question but pointing out that I'm using Code Blocks if that makes any difference.

Upvotes: 1

Related Questions