Cannot open include file: 'ctype.h': No such file or directory - c++

I installed c++ package on VS 2015 , if I tried to build the project ,the following problem appears :
C1083 Cannot open include file: 'ctype.h': No such file or directory Win32Project5 c:\program files (x86)\windows kits\8.1\include\um\winnt.h 31
Any possible solution ....

Repair / Reinstall visual studio.
Make sure that the Windows SDK option (Probably 8.1 in your case) is ticked,
As you can see in this picture:

To add the missing component, go to Control Panel -> Uninstall a Program, and select to Change the installation of Visual Studio.
Then, here is the option you need to check:
Then press "Modify".
Also don't forget to update the project's Properties to be using Windows SDK version 10.0.17134.0.

Right click on your solution or project in the solution explorer
& Retarget your solution or project to the installed SDK version

Here is mine VS 2017 build tools configuration to make Python 3.7 and up to compile on my local machine and fix. Please notice that MS changed VS Studio Build Tools interface
In order to make code to compile you also MUST to install ODBC driver
You can download VS 2017 Build tools from:
https://visualstudio.microsoft.com/downloads/

Related

I just installed visual studio and ran into some errors specifically The WindowsSDKDir property is not defined. Some build tools may not be found

Just installed visual studio 2019 on windows 10, was using visual studio for the first time and ran into the following error, It's a basic hello world console program that I tried to run.
error C1083: Cannot open include file: 'corecrt.h': No such file or directory
1>Done building project "ConsoleApplication2.vcxproj" -- FAILED.
Severity Code Description Project File Line Suppression State
Warning MSB8003 The WindowsSDKDir property is not defined. Some build tools may not be found. ConsoleApplication2 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets 434
I tried searching for this error over YouTube and of course here, and also Microsoft's offical forum but couldn't find anything.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!\n";
}
the code looks just fine.
I ran into the same issue today. It turns out I didn't check the Win10SDK to save disk space while installation.
Solution:
In VS, go Tools menu=>Get Tools and Features=>install the Windows 10 SDK(10.XX.XX.XX)
Once installed, launch VS and open your project, right-click your project(NOT Solution)->properties->General->Windows SDK Version, check the value should be 10.0 instead of blank.
Then the compiling just worked.
I've got the same issue and turned out that I haven't installed Windows SDK. It can be done by typing "Install Windows SDK" into visual studio's search prompt
I had same problem when I installed Visual Studio 2019 on Windows7 and opened project created in Visual Studio 2017 (witch wasn't installed on that machine).
To solve the problem I went to project Properties -> General -> Windows SDK Version
And changed it from 10 to 8.1.
I fixed this issue by repairing Windows SDK. Now it's working as expected.
Steps:
Go to Settings>Apps & Features.
Click on Windows Software Development Kit - Windows 10.0.18362.1
(Note: Version number might be different for you)
Click on Modify.
Select Repair from options.
Click Next.
Restart VS and try running your project.
I was just having thesame issue so I figured maybe the headers were in a different directory than where the program is searching. When I went looking for tge header files none existed. So the problem is probably with iostream not existing.

Visual Studio 2017 with CUDA cannot open include file 'cuda.h'

I am working on the Nvidia SDK with Visual Studio and I have been running into the error of this whenever I am trying to compile the sample from Nvidia:
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'cuda.h': No such file or
directory AppDecPerf
c:\users\administrator\desktop\video_codec_sdk_8.1.24\samples\appdecode\appdecperf\appdecperf.cpp 12
I do have CUDA installed on my computer and it looks like I have to link it with the IDE somehow but I just cannot find 'cuda.h' file anywhere.
Any help is appreciated. Thanks!
Install cuda library( static or dynamic) for Windows in vc++ 2017 using vcpkg.exe. Use .\vcpkg integrate install to automatically link the project to your solution.
Use .\vcpkg install cuda:x64-windows-static to install.
Right click your project, choose Build Dependencies then Build Customizations. From here you can choose the version of the CUDA Toolkit that you'd like to work with (amongst other things it will add the $(CudaToolkitDir) variable, and a new CUDA C/C++ tab to the project properties). The samples from NVIDIA should already be configured this way, but I've noticed that they can break when upgrading the SDK.
Further details are available here:
https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#build-customizations-for-existing-projects

Visual Studio 2017 can't find windows.h

Hell'o
I've just installed Visual Studio 2017 (enterprise).I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library. How to repair this?
My solution was :
Open the project properties
Into General --> SDK Version
I just picked the 10.0.15063.0 version instead of 8.1
And it worked.
I solved this issue by re-running the Visual Studio Installer and selecting the "Modify" button. Once presented with the Workloads screen I clicked on the "Individual Components" tab and selected all of the latest "Windows 10 SDK" Checkboxes(version 10.0.15063.0). My guess is that the entry for "Desktop C++ x86 and x64" is the one the actually fixes it but it is only speculation because none of those options were checked when I ran the installer and as you can see I checked all of them.
This happens when you have customized include/library paths in legacy projects. If you added your own additional paths in project properties, VisualStudio 2017 can't automatically figure out base paths when switching between platforms/toolsets - normally it automatically puts correct paths there, but if you added customizations, VS won't touch them.
This is legitimate problem which I ran into myself recently when migrating old project targeted for Windows XP into VS2017. None of the answers or comments listed/linked here so far are helpful. I have all legacy SDKs in VisualStudio 2017 installer, and none of that fixed VS not finding essential includes such as <windows.h>. In my case the project was using v120 toolset from VS2013, which is superseded by v140_xp in newer VS.
After setting correct platform and toolset understood by VS2017, I did the following to resolve the problem:
Open project properties, go to VC++ Directories, for 'Include Directories' and for 'Library Directories', choose <Inherit from parent or project defaults>. This will remove your additional paths.
Click 'Apply'. This will reset include path to something like $(VC_IncludePath_x86);$(WindowsSdk_71A_IncludePath_x86) (will vary for SDKs).
Re-add your extra paths here, or better yet - under C/C++/General -> Additional Include Directories and Linker/General -> Additional Library Directories.
I got it fixed when I simply changed "General => Windows SDK version" to a different version, submitted the changes and then changed it back.
The problem occurs when you migrate your C++ project from a more updated visual studio version to a lesser one.
To solve the issue simply go to your :
Project's properties-->General-->SDK Version [and here unroll to show installed SDK versions so you downgrade to an available version {Since the required one seems unavailable hence the error}].
Once one of the Available SDKs selected, Apply, and go back to your code, and everything gonna get fixed.
If the installation was ok it should be here:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\Windows.h
So be sure it is on the include path of the project properties.
Or if you prefer by manual edit in the .vcxproj file at the IncludePath Tag line:
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;</IncludePath>
TL;DR: make sure the checkbox, marked below, is checked.
In the Include Directories Dlgbox, there's an option at the bottom "Inherit from..." that needs to be checked. Somehow it got unchecked after moving a project to a different solution.
So, in my case, resetting to defaults and adding custom paths again wasn't even needed.
You have to go in Visual Studio 2017 Installer, choose Individual Components, and manually select and install Windows 8.1 SDK.
This step work for me.
1. Open visual studio installer
2. at menu "Visual studio comunity 2017" --> click modify
3. at desktop development with c++ --> enable windows10 SDK for desktop and windows 8.1 SDK
4. click modify
I've also installed Visual Studio 2017 (community) first with the default composition settings.I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library and other problems. At first I install the missing (SDK 10 ... etc.) components. Part of problems is gone, but windows.h still not found. The problem was solved by completely uninstalling VS2017 and then installing with all the options at once.
My solution was checking paths.
Include Directories:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;
%(AdditionalIncludeDirectories)
Library Directories:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64
and then right click Solution Explorer: Solution 'xxxxx' (1 project) line click "Retarget solution"
Remember to set Debug setting for Symbols fetch - Windows 10 must use Microsoft symbol server!

how to build CPP project in TFS 2012 update 1 build

i am trying to compile a cpp project on in my auto build and i get this messages
The imported project "c:\Microsoft.Cpp.Default.props" was not found.
i add the reg key for the location
and got this message
The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v110\Microsoft.Cpp.Default.props
of course i saw this post but i want to solve it without install visual studio on my build machine
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3c22511b-3117-40e6-846b-81042bd30507/tfs2010-build-machine-can-not-build-cpp-project
help would be appreciate
thanks shlomi
Install a Windows SDK (e.g. 7.1) to get a build environment similar to Visual Studio. You need to select one that supports the MSVC toolset you are using (v110). I believe 7.1 does.

MSVCP100D.dll missing

When I try to debug my C++ application I get the error
The program can't start because MSVCP100D.dll is missing from your
computer. Try reinstalling the program to fix this problem.
I found someone with a similar problem here: Remote debugging C++ on the Windows Server 2008 platform with VS2010; MSVCP100D.dll missing however the solution given there doesn't seem to show up when I go to the solution properties.
Would reinstalling Visual Studio fix this problem?
Usually you don't want MSVCP100D.dll on your system. It's for debugging purposes only. If you get this error for your release build you must make sure that you didn't accidently add a 'Debug'-tagged Project Output to your setup project.
If you really need to debug your software on a remote machine, I suggest you do the following:
Create a new Setup project called 'CRTDebug100Setup' and add the following Merge Modules (found under C:\Program Files\Common Files\Merge Modules):
Microsoft_VC90_DebugCRT_x86.msm
policy_9_0_Microsoft_VC90_DebugCRT_x86.msm
Build, and deploy on your computer to be debugged!
Reinstalling Visual Studio fixed the problem.
This can also occur if Generate Debug info is not set to No
Configuration Properties -> Linker -> Debugging -> Generate Debug info
Followup on l33t's answer above (tried to revise it but it did not seem to appear).
Added later by gpicher 10 Jan 2012: I believe those .msm packages would be for a 9.x version of the DLL in question, not a 10.x version. I resolved a similar problem I had by making a setup project with Visual Studio 2010 installed on a 64 bit Windows installation, using the merge module Microsoft_VC100_DebugCRT_x86.msm in the folder C:\Program Files (x86)\Common Files\Merge Modules. There's a similar x64 version of the .msm if the application showing the error dialog is a 64 bit application. In this case a third party was providing me a debug build of their application in order to develop and test new plugin code against, so I couldn't change build settings, and wanted the debug functionality.
Find the Visual Studio 2010 install iso file.
Extract cab44.cab file from the ISO.
Then extract file "F_REDIST_DLL_APPLOCAL_msvcp100d_x86" from the .cab file using 7z.
Rename the file to msvcp100d.dll.
For x64 version. The cab file name is cab26.cab and the file name is F_REDIST_DLL_APPLOCAL_msvcp100d_x64.
For similar issue such missing msvcr*d.dll for another visual studio version. Here is the way I used to find the answer:
Find the Visual Studio ISO.
Extract all the .cab file.
7z.exe t *.cab > filelist.txt
gvim filelist.txt
searching for the interested file name. Hope this helps.