CUDA 9 unsupported error with Visual Studio 2017 - c++

I've recently updated my VS 2017 and now I cannot even build a default CUDA project (the one with the vector addition).
I suspect that this is due to the following error:
Severity Code Description Project File Line Suppression State
Error C1189 #error: -- unsupported Microsoft Visual Studio version!
Only the versions 2012, 2013, 2015 and 2017 are supported! ver2
c:\program files\nvidia gpu computing
toolkit\cuda\v9.0\include\crt\host_config.h 133
The other errors are irrelevant and will disappear once I fix this one. Note, that I am able to build and run simpleCUFFT from CUDA samples.
Before the update I was able to build the default CUDA project but I was not able to build the CUDA Sample project. I've updated my VS2017 using VS installer and installed CUDA SDK 10.0.15063.0. Attached is the screenshot with the installed components.
Please let me know if any additional information is required. I am aware of the following topic and since I am using the latest CUDA toolkit, I don't need to make changes in host_config.h.
Thanks,
Mikhail
Edit:
My VS version (as displayed in VS installer) is 15.5.0
My nvcc version is release 9.0, V9.0.176
Edit2: I've tryied to change host_config.h line 133 to:
#if _MSC_VER < 1600 || _MSC_VER > 1912
This error does not show up anymore, however, a bunch of errors "expression must have a constant value" show up in the file type_trails. I have no clue how to fix it.

After some painful time, I was able to solve the problem. Here is the answer for those who have a similar problem:
1) Make sure that you have VC++ 2015.3 v140 toolset (can be installed either from web or Visual Studio installer)
2) In the project properties (general) -> Platform toolset choose Visual Studio 2015 (v140).
Edit (5/21/2018): I've just updated Visual studio 2017 to the latest version 15.7.1. From now on, I can choose VS 2017 v141 toolset and it works fine.

I'm using CUDA 9.2 and VS 2017 (Version 15.7.5). Simply Modifying host_config.h (usually under C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.*\include\crt, can be found in the VS output from build) works for me.
Change the line
#if _MSC_VER < 1600 || _MSC_VER > 1913
to
#if _MSC_VER < 1600 || _MSC_VER > 1914
or something similar, based on the version of cl.exe

In VS update 15.4.3 Microsoft updated version number of their CL compiler to 14.12
(https://www.visualstudio.com/ru-ru/news/releasenotes/vs2017-relnotes#15.4.4)
That's why CUDA 9.0.176 refuse to compile.
Today NVIDIA updated CUDA to 9.1.85, so just update
just update CUDA to 9.1
https://developer.nvidia.com/cuda-downloads

For anyone that's reading this question, update in CUDA 10. It works right out of the box. No need to install previous compiler tool-sets and the like mentioned in other answers. Simply download CUDA 10, install it and uninstall previous CUDA versions. Then make a new CUDA 10 project and place your code. It will work.
If you're getting errors, don't forget to set compute_xx,sm_xx appropriately, in Project Properties -> CUDA C/C++ -> Device -> Code Generation.

Related

How to get compiler version 19.0.24234 for Visual Studio 2015 Update 3?

When researching on libmdbx, I found its sources require MSVC compiler version >= 19.0.24234 for "Visual Studio 2015 Update 3".
I have to stick to Visual Studio 2015 Update 3, cannot upgrade to Visual Studio 2017 or later. But my compiler version is 19.00.24223.
It seems that if you install the Visual Studio 2015 Update 3 freshly from an offline ISO, the initial compiler version would be 19.00.24215.1. (ref: Offline install ISO)
Then if you install this update (KB4020481), the compiler version is bumped to 19.00.24223
I installed this update (KB3165756), the compiler version did not change.
There is a page listing all _MSC_VER_FULL values:
https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd
The version number for 2015 Update 3 is 190024210.
So is 190024234 really a valid compiler version from Visual Studio 2015 Update 3? Or is it actually from Visual Studio 2017?
If you search google with "_MSC_FULL_VER 190024234", you will get very few results, with top ones being the github sources from user erthink, where happnes to be the repo of libmdbx. In the source it claims that 19.00.24234 corresponds to Visual Studio 2015. So is there any "KB" update that can bump the compiler versio to that required one? Thanks.
# if _MSC_FULL_VER < 190024234
/* Actually libmdbx was not tested with compilers older than 19.00.24234 (Visual Studio 2015 Update 3).
* But you could remove this #error and try to continue at your own risk.
* In such case please don't rise up an issues related ONLY to old compilers.
*/
# error "At least \"Microsoft C/C++ Compiler\" version 19.00.24234 (Visual Studio 2015 Update 3) is required."
# endif

CUDA: Triple Angle Brackets gives me an error in Visual Studio [duplicate]

I'm trying to install CUDA, but I get a message saying "No supported version of visual studio was found". I think that this is because I am using Visual Studio 2017 (Community), and CUDA currently only supports up to Visual Studio 2015. Unfortunately, Microsoft will not allow me to download old versions of Visual Studio without paying a subscription fee.
Is there a way I can get around the compatibility issue with VS 2017, or can I not use CUDA?
If you want to install CUDA 8.0 with Visual Studio 2017 you need to install additional components for Visual Studio 2017.Click on the Start Menu and type Visual Studio Installer. Open Visual Studio InstallerOpen Individual components tab and select VC++ 2015.3 v140 toolset
under Compilers, build tools and runtimes.
You also need to install .NET Framework 3.5 if you didn't have it installed. Nvda.Build.CudaTasks.v8.0.dll assembly dependents on MS .NET Framework 3.5.
Open Classical Control Panel, go to Programs and features and press Turn Windows features on or off. Check .NET Framework 3.5 and press OK.
Download full CUDA toolkit distribution and extract it somewhere on your disk.
If you didn't have CUDA toolkit installed, do it now. If you have only Visual Studio 2017 installed, unselect Visual Studio integration checkbox.
Now you want to receive the "No supported version of the visual studio was found" error.
But in order to successfully build Cuda toolkit projects in Visual Studio 2017, you also need to follow steps 5 and 6.
Go to the CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions folder in your extracted distribution, copy all the files and paste them to C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\BuildCustomizations:
In the last step, you will need to edit your Cuda projects to recognize NVidia's build tasks from Visual Studio 2017. Open your .vcxproj file in a text editor and find all occurrences of CUDA 8.0.props. Replace the macro at the beginning of the string with $(VCTargetsPath14) so that XML snippet would look as follows:
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath14)\BuildCustomizations\CUDA 8.0.props" /></ImportGroup>
Don't forget to edit the custom targets path at the end of the file:
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath14)\BuildCustomizations\CUDA 8.0.targets" /></ImportGroup>
Make sure to double check your path conifuration!
If you use nvcc from command prompt you might not be calling cl.exe from Visual Studio folder!
Now you can build your Cuda project from Visual Studio 2017.
Parts of this solution are from Oleg Tarasov blog.
At the moment, Microsoft still seems to be making VS2015 Update 2 community edition available. You have to join the "dev essentials" program, but it seems to be free.
I was able to download the installer from here recently.
Update: CUDA 9 RC was made available yesterday at developer.nvidia.com to registered developers, and it has support for VS 2017.
Thank you everyone for your help. I just wanted to supplement this post with the last pieces of the puzzle. CUDA v9.0 RC is looking for VS2017 to identify as 1910 but the latest update actually identifies as 1911. To fix open .../CUDA/v9.0/include/crt/host_config.h and change this line:
#if _MSC_VER < 1600 || _MSC_VER > 1910
to this:
#if _MSC_VER < 1600 || _MSC_VER > 1911
You may also have to add the following to your CMakeLists:
list(APPEND CUDA_NVCC_FLAGS --cl-version=2017)
For people seeing this latter.
First, try to just install CUDA 10 (CUDA Toolkit 10.0).
If it still doesn't work without any mods make sure that you have as many VC++ toolsets as you see on the list. Check out this video, stop at 8:41 and compare the lists.
If for some reason you have to use CUDA 9.0 - 9.2 you will need to jump some hoops:
For cmd builds set vcvars_ver=14.11 - see this answer
For IDE builds set Platform Toolset (in project properties - General) to
Visual Studio 2017 (v141)) or
Visual Studio 2015 (v140))
If you have very customized cmd based build, hunt #if _MSC_VER (in .../CUDA/.../include/crt/host_config.h) and remove trailing || _MSC_VER > ...
In order to get working Cuda compiler nvcc in windows shell you need to do following
install proper toolset version from individual component for VS 2017 - VC++ 2017 version 15.4 v.14.11 toolset
Run in windows shell following "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11
You can compile nvcc code without errors from windows shell
I ran into the same issue using CUDA 9.1 and VS2017 Enterprise.
After changing the VC++ compiler to v140 (instead of 141) everything runs fine.
Already had flags
#if _MSC_VER < 1600 || _MSC_VER > 1911
But it wouldn't stop showing the error.
No idea why, but trying to run it on VS2015 lead to errors about v141 not being installed... so because of some twisted logic I tried to not use v141 where it was installed... and everything worked!!
Leaving this here as it may help someone else in the same situation. (although I really don't understand the why, how, when, who or what of the solution.
Latest update (correct as of 06/12/2018) latest Cuda version is 9.2 and latest Visual Studio version is 2017.7 do NOT work together. The instructions provided in solution above don't work. Here is what worked for me:
Uninstall Visual Studio.
Uninstall Visual Studio Installer
Download Visual Studio 2017.6 (note that Microsoft is known to change links and revisions without notice) https://learn.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017
Launch installer
Go to Individual Components. Click on Windows 10 SDK 10.0.15063
enter image description here
Download cuda Toolkit from the official website: https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
You may need to download patch.
I wanted to edit my CUDA programs using a text editor (i.e. Sublime) and compile them from the command prompt but I ran into an nvcc compiler error. I installed Visual Studio 2017 with Windows 10 OS but after compiling, it said "only version of VS 2012, 13, 15 and 17 are allowed." So what I did was to intall VC++ 2015 toolkit from the installation package of the VS 2017 installer (refer to the image of the top post). I didnt go through his entire process instead, I only copied the path of my cl.exe file from the newly created VS 14.0 folder to the environment variable. The .exe can be found here:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
Hope this helps!
Just as update. My compatibility is:
Cuda version 11.2
Visual Studio Community 2019

Visual Studio - "Unknown Compiler version" after upgrading

I have a Visual Studio 2015 C++ project which I wanted to upgrade to VS 2017. I had already denied the automatic prompts to upgrade my project when I first opened my project in VS 2017 (wasn't sure I wanted to upgrade at the time) so I couldn't update my project that way. Instead, I just went to my project's:
Properties->Configuration Properties->General
And in there I updated the 'Platform Toolset' option to 'Visual Studio 2017 (v141)' and also changed the 'Window SDK Version' to 10.0.16299.0 from windows 8.1. After performing this manual upgrade I now get the warning when building:
Unknown compiler version - please run the configure tests and report the results
Why am I getting this warning? I thought by changing the 'Platform Toolset' to VS2017 I would be using the VC2017 compiler. How do I fix this warning?
This line is from boost/config/compiler/visualc.hpp so the solution would be to upgrade to the boost 1.65.1 which properly acknowledges new version of Visual C++ compiler.

MSBuild configuration error WDK 8.1 Visual Studio 2015 to build kernel mode driver

I'm struggling with VS 2015 C++ 'Platform Toolset' configuration property to build a test *.sys kernel driver I want play around this night.
So, this is a fresh new installation of VS 2015 Pro (update 1) plus WDK 8.1 (just downloaded) running on clean Win 8.1
All libs and headers like ntddk.h are in place.
But C++ Solution Explorer -> General -> Platform Toolset does not eat every option:
Visual Studio 2015 (v140) -- ok
Visual Studio 2015 - Windows XP (v140_xp) -- ok
WindowsApplicationForDrivers8.1 -- error
WindowsKernelModeDriver8.1 -- error (need this one)
WindowsUserModeDriver8.1 -- error
Nags as follows:
One or more values are invalid. MSBuild returned the following error:
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\v120\Microsoft.cpp.props" was not
found. (Directory exists though!) Confirm that the path in the
declaration is correct, and that the file exists on disk.
C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Redirect.12.props
I don't know what it could be. Am I supposed to have WDK 10 towards to VS2015?!
Anyway, I need the ability to build the driver on VS 2015.
Could it be directed compiler scripts?
Any ideas?
Ok
Moving to WDK 10 helped!
https://msdn.microsoft.com/en-us/windows-drivers/develop/building_a_driver
Ensure that you have the same version of SDK and WDK installed on your
computer.
You need to install the driver update for visual studio if you are working on visual studio then you have to get the proper update for it. I've a link please follow this link and you will get rid off from this problem..enter link description here
enter link description here

Winres.h copilation error in CryEngine EaaS

I am new to Cryengine and I am trying to build custom Game DLL for my game.
But first, I tried to compile CryGameZero DLL and I came up with some compilation errors.
I am using VS2013 Professional.
Error RC1015: cannot open include file 'winres.h'.
c:\...\CRYENGINE\BinTemp\rc_files\CryGameZero.auto_gen.rc
10 1 CryGameZero
Error MSB3073: The command "cd /d
"c:\...\CRYENGINE" & cry_waf.exe
build_win_x86_profile --project-spec gamezero
--execsolution="c:\...\CRYENGINE\Solutions\CRYENGINE.sln"
--targets=CryGameZero" exited with code 1.
c:\...\CRYENGINE\_WAF_\msbuild\waf_build.targets
69 3 CryGameZero
I checked in my VC++ Directories and I had C:\Program Files (x86)\Windows Kits\8.0\include\um
but winres.h was not in that directory so I changed to C:\Program Files (x86)\Windows Kits\8.1\Include\um where is winres.h located but I still get the same error.
Does anybody had the same problem or know how to fix this. I was searching on Google but so far I found documentation and tutorials on doing this with older versions of Cryengine without WAF and using VS2010 or VS2012.
I found a solution for this problem.
Here is the solution step by step.
First check for WAF configuration.
cry_waf.exe configure --auto-detect-verbose True
--generate-vs-projects-automatically False
In my case, WAF was automaticaly detecting MSVC and Win SDK versions and fout
MSVC 11.0
MSVC 12.0
And automaticaly set it to MSVC 11.0 because that was first in the list.
The same goes with Win SDK versions, found
SDK 8.0
SDK 8.1
Amd automatically set to 8.0
Since I am using Visual Studio 2013, According to Crytek documentation you need to set versions of MSVC and Win SDK to suite your VS version
VS Version VC++ Version Recomended Win SDK
2012 11.0 8.0
2013 12.0 8.1
2015 14.0 10.0.10240.0
NOTE FOR VS2015: Early installations of Visual Studio 2015 may have installed 10.0.10150.0 instead. In this scenario, re-run the
Visual Studio installer and select the recommended version.
Set that to appropriate versions, clean solution and build again made all as good as it needs to be.