QtQreator 5.2 won't compile any project and gives C1083: Cannot open include file: 'stddef.h': No such file or directory - windows

I installed Qt5.2 msvc2012 version on my system, and after couple of failed tries to compile my projects - which were coded in the mingw version on windows (actually the Android package one) - I tried to create a new gui project and see if that works.
No surprise it didn't work and gave me the error:
F:\ms\Qt5.2.0\5.2.0\msvc2012\include\QtCore\qglobal.h:46: error:
C1083: Cannot open include file: 'stddef.h': No such file or directory
I searched a lot of places but couldn't figure out what was causing this problem. I even uninstalled the mingw version completely (5.2.0-android-x86-win32-offline.exe) still no luck.
I had Visual Studio 2010 and Visual Studio 2013 installed on my system when I went for installing qt5.2, the mingw version worked fine till when I had to switch to msvc for my project. I tried installing 5.2.0-msvc2012-x86-offline.exe and noticed it needs Visual Studio 2012 in order to compile, so I went and installed Visual Studio 2012.
After that I am getting such error plus several ones mentioned here. I even tried installing WDK and WSDK but it's not working. The path I believe is configured correctly and files do exist. This is my include path in environmental variable on windows 7sp1 x86
J:\Program Files\Microsoft Visual Studio 11.0\VC\INCLUDE;J:\Program Files\Microsoft Visual Studio 11.0\VC\ATLMFC\INCLUDE;C:\Program Files\Windows Kits\8.0\include\shared;C:\Program Files\Windows Kits\8.0\include\um;C:\Program Files\Windows Kits\8.0\include\winrt;
What is wrong and how can I solve this problem?

Related

Visual Studio 2022: Cannot open include file: 'ctype.h'

I've got the infamous error message in C++ build: "Cannot open include file: 'ctype.h'". I know a similar question was already asked multiple times, but my case seems different because I am using the latest Visual Studio 2022 and seems to behave differently.
I have a bunch of existing C++ projects, they use plain 32-bit Windows API with DirectX 6, and I used VC++ build tools 2015 and Windows SDK 8.1 to compile it without any issues in previous versions of Visual Studio. Everything was fine in Visual Studio 2019, no special setup was needed, until I uninstalled it and installed Visual Studio 2022.
Now I can open my solutions, it nicely shows they are using C++ build tools 2015, which I installed together with VS2022, and the solutions also shows correctly that they use Windows 8.1 SDK. But Windows 8.1 SDK is not present in VS2022 installation, I installed it separately. I also tried to "repair" VS2022 installation, but that only deleted all my UI preferences, but not fixed anything in build. Also, I tried to reinstall Windows 8.1 SDK, but it said it is already OK.
When looking to Visual Studio, I can't see any place where I can set default include and lib directories, I can only list what is being used right now. VS2022 shows this list:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include
C:\Program Files\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
The actual error message I receive is this:
c:\program files (x86)\windows kits\8.1\include\um\winnt.h(31): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
So it says that winnt.h from windows kits 8.1 cannot find ctype.h. And yes, there is no ctype.h in that folder or anywhere around, I can see it only in C:\Program Files\Microsoft Visual Studio\2022\Professional\SDK\ScopeCppSDK\vc15\SDK\include\ucrt
which I think is the folder with VC++ 2015 build tools. So this seems correct, but I am wondering why this folder is not a part of default include directories when VC++ 2015 build tools are set in project settings. Because it seems that VS2022 is correctly picking my Windows 8.1 SDK, but not picking correctly the older C++ compiler.
When I try to add the folder where ctype.h resides to include folders, I receive another type of errors saying that other files are incompatible with these include files. Of course, this system of directories needs to be in sync. So please what is the correct way of using this?
Also, I tried to switch the VC++ build tools to 2022 version. Unfortunately, that also does not fix the issue. And Windows 10 SDK is not installed, the software wants to stay compatible with older Windows, so I don't need it.
I found a bug report which is related: https://developercommunity.visualstudio.com/t/windows-81-sdk-1/151682
Although Microsoft staff declined to accept it as a bug, it is happening for me as well. When I install only Windows 8.1 SDK, no project can be compiled with it. I even tried to create a new Windows API project in VS2022, the project was created, but failed to compile with the same error.
So I tried to install Windows 10 SDK (from VS2022 installed, but that is probably not important) and this added some missing files which now help to compile Windows 8.1 SDK projects. Problem seems to be solved, my old C++ code can now be compiled with Windows 8.1 SDK and both C++ build tools 2015 and 2022.

What do I need to do CUDA development on Windows 10?

I've installed the CUDA 10.2 tools on Windows 10 along with Visual Studio Community Edition. When I run the nvcc compiler on a .cu file from the command line it complains that it cannot find cl.exe, which apparently is a Microsoft compiler. If cl.exe is part of VSCE it didn't get put on the PATH. Maybe there are additional steps that I don't know about
Also, VSCE doesn't know what .cu files are and I can't find any extensions for NVidia or CUDA.
Does VSCE support CUDA development, or do I need the commercial edition or something else to get going with CUDA development on Windows?
Update:
I tried building one of the sample projects (CUDA Samples\v10.2\1_Utilities\deviceQuery) by importing it into VSCE and it fails with this message:
Error MSB4019 The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 10.2.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\\BuildCustomizations\CUDA 10.2.props" is correct, and that the file exists on disk.
The solution is here. The CUDA installation guide fails to mention that you have to copy several files from the CUDA installation to the VSCE installation.

Build with sdk 7.1 on VS2015

I have Visual Studio 2015 installed, and I need to compile a specific project with Visual C++ 2010 compiler, which is included in SDK 7.1.
I want to use 2010 compiler within VS2015, without install VS2010.
So, I installed it (the SDK), and "Visual Studio 2010 (v100)", "Windows7.1SDK" options appear under "Platform Toolset" property in the project properties.
But, when I try to build the project, I get those errors:
With "Windows7.1SDK" -
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5): error : Required file "" is missing.
and with "Visual Studio 2010 (v100)" -
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5): error : Required file "" is missing.
Can't figure out what the problem is..
I had the same issue for 2 weeks and just found a workaround that might help :
Without modifying anything to my VS2010 projects (not changing the toolset in the vcxproj), I use the command line build tools MSBuild tools with the toolset specified as a switch as found here Building C++ project on a PC with Windows SDK 7.1 but without VS2010
msbuild /p:PateformToolset=Windows7.1SDK project.vcxproj
(In my case, the corresponding msbuild is in the folder C:\Windows\Microsoft.NET\Framework\v4.0.30319)
If Msbuild throws an error telling its missing mspdb100.dll, you may need to add %PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\Common7\IDE\ to your %PATH% env var.
Finally, you may have some files missing like ammintrin.h (especially if like me you try to compile old InDesign plugins) even after installing the visual c++ updates.
The only (and ugly) workaround I found in my case that does not involve installing VS2010 (the common answer of MS) is to copy the missing includes from the %PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\include folder to the %PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\VC\include one.
Voila ! Hope this helps

Can't compile in Visual Studio: can't find WindowsSDKDir variable in registry, or winapifamily.h

On compiling a program in Visual Studio on a laptop, I'm seeing these warnings/errors:
warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
error C1083: Cannot open include file 'winapifamily.': No such file or directory
On leaving the program (don't know if this is related), I see this error:
An error occurred while creating or opening the C++ browsing database file c:....sdf.
Ensure that Microsoft SQL Server Compact 4.0 is installed and no other applications are accessing the file.
What should I reinstall, or set?
My previous answer was deleted, however I believe it to be correct, so let me clarify it.
If you're targeting Windows XP with Visual Studio 2013 and you get winapifamily.h not found, you're probably missing the Windows 7 Platform SDK. The v120_xp toolset cannot find the V7.1A includes so it includes Windows 8 SDK files which include winapifamily.h (an include that was added in Windows 8) but that doesn't exist with the v120_xp toolset. So like I said, installing the Platform SDK (Windows 7) fixes it.

Compiling FFTW source in Visual studio

Recently I am trying to compile the source code of FFTW in Visual studio 2010. I followed the instruction from the FFTW website. I downloaded the source code fftw-3.3.2.zip and corresponding vs 2010 package fftw-3.3-libs-visual-studio-2010.zip.
I got four projects from the solution, bench, benchf, libfftw-3.3, libfftwf-3.3
But on compiling I got following errors on each of the project:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(514,5): error MSB8008: Specified platform toolset (Windows7.1SDK) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
which points to the following content
I have tried the debug/release build for both x64 and win32, none of them worked.
Could anyone please help me on this?
It seems that it can be solved without installing the Windows 7.1 SDK
Right click on the 'libfftw-3.3' project and selected properties
Go to Configuration Properties -> General
Switch 'Platfrom Toolset' from 'Windows7.1SDK' to 'v100'
Recompile
Works for the projects 'libfftwf-3.3' and 'libfftw-3.3'
The project 'bench' and 'benchf' are failing to build:
fatal error C1083: Cannot open source file: '....\libbench2\aligned-main.c': No such file or directory
Can be solved by removing the aligned-main.c from both projects.
You can also use CMake - I created this CMake file for fftw-3.3.2 which I tested with Visual Studio 2010 x64:
https://bitbucket.org/Vertexwahn/cmakedemos/src/670f189321d89dbd61ddc8c446c91578305f9da2/fftw-3.3.2/CMakeLists.txt?at=default
You also need this config.h file:
https://bitbucket.org/Vertexwahn/cmakedemos/src/670f189321d89dbd61ddc8c446c91578305f9da2/fftw-3.3.2/config.h?at=default
It looks like you need to install the Windows 7.1 SDK, if you have already installed it, try reinstalling it incase it is corrupted.
You can download the 7.1 SDK from http://www.microsoft.com/en-us/download/details.aspx?id=8279

Resources