I cannot run any of the sample applications that come with directx - visual-studio-2010

I downloaded the latest DirectX, I have Windows 7 and Visual Studio 2012. When I open any of the sln files from the samples folder and try to build them, I get the same error "main entry point not found".
For example:
"Error 6 error X3501: 'main': entrypoint not found C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D\ShadowMap\FXC ShadowMap"
What is wrong?

Visual Studio 2012 by default is trying to compile the ".fx" shader code. You need to turn this off if you want to use a downloaded SDK (the most current version of the DirectX SDK is now part of the Windows SDK).
The (old) DirectX SDK samples use the run-time HLSL compiler (via functions like D3DX11CompileFromFile()). ".fx" files are now by default compiled by Visual Studio 2012.
You need to select any ".fx" or ".hlsl" shader program files in VS2012 and set them to "exclude from build" (right-click the ".fx" file and select "Properties" > "General" > "Exclude from build" > "Yes").

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.

CMake and Visual Studio: failed to run MSBuild.exe

I'm trying to build the OpenCV's source files and generate a Visual Studio project using CMake. I'm facing a problem that seems not solved neither with these given following recommendations: here - select the Visual Studio's correct version (e.g. v16 2019) when building with CMake, install MSBuild.exeand add its location to the system PATH -, here - install Windows SDK - and here - install required workload in Visual Studio regarding CMake/C++ and reboot it.
Then I ask for your kind help. I'm currently working with:
OS: Windows 8.1 Pro 64 bits
CMake (GUI) Version 3.17.2, located at C:\Program Files\CMake\bin
Microsoft Visual Studio 2019 version 16.6.0
MSBuild. exe version 16.6.0, located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
OpenCV 4.3.0, located at D:\opencv;
sdksetup.exe version 8.100, located at C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1\StandaloneSDK
My Path in my system's environment variables is: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\MinGW\bin;C:\Program Files\CMake\bin\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\;C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\
I open the CMake with admin rights, then select "Visual Studio 16 2019" as generator, and I always got the following error pop-up when clicking in the "Configure" button:
Error in configuration process, projects files may be invalid.
I tried to do it with two different CMakeLists.txt, a simple one and a complete one.
The simple script
# cmake needs this line
cmake_minimum_required(VERSION 3.1)
# Define project name
project(opencv_example_project)
# Find OpenCV, you may need to set OpenCV_DIR variable
# to the absolute path to the directory containing OpenCVConfig.cmake file
# via the command line or GUI
find_package(OpenCV REQUIRED)
# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
# Declare the executable target built from your sources
add_executable(opencv_example example.cpp)
# Link your application with OpenCV libraries
target_link_libraries(opencv_example PRIVATE ${OpenCV_LIBS})
In this case, the status bar warned:
CMake Error at CMakeLists.txt:5 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft(R) Build Engine versÆo 16.6.0+5ff7b0c9e para .NET Framework
Copyright (C) Microsoft Corporation. Todos os direitos reservados.
The complete script
Which can be found here https://github.com/opencv/opencv/blob/master/CMakeLists.txt. I took care to delete all CMakeCache files and to delete cache inside CMake-GUI.
In this case, the status bar warned:
CMake Error at CMakeLists.txt:106 (enable_language):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft(R) Build Engine versÆo 16.6.0+5ff7b0c9e para .NET Framework
Just to finish: in "About" section inside Microsoft Visual Studio, we can see which Workloads were loaded:
Microsoft Visual Studio Community 2019
Version 16.6.0
VisualStudio.16.Release / 16.6.0 + 30114.105
Microsoft .NET Framework
Version 4.8.03761
Installed Version: Community
Visual C ++ 2019 00435-60000-00000-AA905
Microsoft Visual C ++ 2019
Test Adapter for Google Test 1.0
Enables Visual Studio testing tools with recorded unit tests for Google Test. The terms of use and Third Party Notices are available in the extension's installation directory.
ASP.NET and Web Tools 2019 16.6.936.3669
ASP.NET and Web Tools 2019
Microsoft Visual C ++ 1.0 wizards
Microsoft Visual C ++ wizards
IntelliCode 1.0 extension
Detailed IntelliCode Extension Information for Visual Studio
Tools C # 3.6.0-4.20251.5 + 910223b64f108fcf039012e0849befb46ace6e66
C # components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Basic Tools 3.6.0-4.20251.5 + 910223b64f108fcf039012e0849befb46ace6e66
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio tools for CMake 1.0 (interesting)
Visual Studio tools for CMake (uhmm okay)
NuGet Package Manager 5.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Visual Studio Code 1.0 Debug Adapter Host Package
Interoperability layer to host Visual Studio Code debug adapters in Visual Studio
Microsoft Visual Studio 1.0 VC package
Microsoft Visual Studio VC package
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Visual C ++ for Multiplatform Mobile Development (Android) 16.0.30014.67
Visual C ++ for Multiplatform Mobile Development (Android)
Thanks a lot!

Visual Studio 2017 does not detect Windows Driver Kit installation

I already have Visual Studio 2017 professional with Desktop Development with C++ installed.
I am trying to build the Virtual Serial project found here:
https://github.com/Microsoft/Windows-driver-samples/tree/master/serial/VirtualSerial
When I try to build it, I get the error:
Severity Code Description Project File Line Suppression State
Error MSB8020 The build tools for WindowsUserModeDriver10.0 (Platform Toolset = 'WindowsUserModeDriver10.0') cannot be found. To build using the WindowsUserModeDriver10.0 build tools, please install WindowsUserModeDriver10.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". virtualserial C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets
I cannot find any instructions on installation aside from this website.
https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
I downloaded the WDK for Windows 10, version 1803.
I closed VS2017 and ran the installer.
When running the installer I got the message in the screenshot below, I clicked Next to continue installing
After running the installer, the project still does not build, with the same error: WindowsUserModeDriver10.0 is not installed.
What am I missing during installation? Is this the correct installer for regular VS2017 (not community edition)?
Thanks,
I know this is old, but I recently fell into this rabbit hole. What worked for me was uninstalling all of the WDKs, rebooting, and installing WDK 1803 (the wdksetup.exe program downloaded from Other WDK downloads shows version 10.0.17134.1 in properties). That WDK installer specifically calls out VS 2017 when you add the Visual Studio integration at the end of the install process.
In my situation, I installed vs2022 with SDK 19041 and WDK 19041.
After some testing, I realized that VS2022 only supports WDK 22621(so on this date). So I installed WDK 22621 and SDK 22621, and problem solved.
If you still can't find Kernel Driver Build option, try run this file C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\10.0.22621.0\WDK.vsix(WDK 19041 only has VS2019). It's a Visual Studio's extension.
According to this: https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/windows-wdk-on-visual-studio-2017-community/fdbd2b44-e57a-4849-903d-04001205a764
WDK is not currently supported by visual studio 2017.
This is ridiculous

QT - Set windows platform version

I updated my Windows version to 10.0.15063.0 and every lib is missing, so I had to change the platform version to 10.0.14393.0 on Visual Studio, is there any equivalent for QT? The reason I ask is because QT seems to be using the 10.0.15063.0 version and so I get errors like kernel.lib / shell32.lib are missing, etc.
Option 1
You need to install the Windows 10 SDK for 10.0.15063.0
If you have Visual Studio 2017 installed this can be done by using the "Visual Studio Installer". In "Individual components", check "Windows 10 SDK (10.0.15063.0) for Desktop C++ x86 and x64" and apply the changes.
Option 2
Command line
If you build your project from the command line you can specify which Windows kit you want to use when calling vcvarsall.bat
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 10.0.14393.0
Qt Creator
If you use Qt Creator, the call to vcvarsall.bat is made automatically. You can see the call in Qt Creator settings in "Build & Run" > "Compilers".
However the GUI does not provide a mean to add extra arguments to the command line.
You might be able to force the arguments by editing C:\Users\<username>\AppData\Roaming\QtProject\qtcreator\toolchains.xml. This file should contains something like:
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBat">C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat</value>
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBatArg">x86</value>
You could change it to:
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBat">C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat</value>
<value type="QString" key="ProjectExplorer.MsvcToolChain.VarsBatArg">x86 10.0.14393.0</value>
But keep in mind that you are not supposed to edit this file by hand and it may or may not work.

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

Resources