I have installed VS2022 version 17.14.23 and CUDA tool kit 13.1.0
I have also updated my Nvidia driver, currently using NVIDIA GeForce RTX 4060 Laptop GPU, version 591.74
I kept encountering these errors:
I have tried reinstalling VS2022, CUDA toolkit 13.0.0 and tried CUDA tool kit 13.1.0 but they all gave me the same error.
I have also tried changing the code generation from 75 to 89, added additional compiler option “-allow-unsupported-compiler”.
I can compile the project manually via command prompt but not on VS2022.
These are the error output:
1> Output file "C:\CudaTest\Test\Test\x64\Release\kernel.cu.obj" does not exist.
1> Task "Message"
1> Compiling CUDA source file kernel.cu...
1> Done executing task "Message".
1> Task "Message" skipped, due to false condition; ('$(__ExcludedFromBuild)' == 'true') was evaluated as ('' == 'true').
1> Task "MakeDir" skipped, due to false condition; (!Exists('$(CompileOutDir)')) was evaluated as (!Exists('C:\CudaTest\Test\Test\x64\Release')).
1> Task "MakeDir" skipped, due to false condition; ('$(__Keep)' == 'true' AND !Exists('$(__KeepDir)')) was evaluated as ('false' == 'true' AND !Exists('x64\Release')).
1> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 13.1.targets(800,13): message : Property reassignment: $(__CommandLineTemplate)=""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin\nvcc.exe" [CodeGeneration] --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu [GenerateRelocatableDeviceCode] [ExtensibleWholeProgramCompilation] [Include] [RequiredIncludes] [InterleaveSourceInPTX] [GPUDebugInfo] [GenerateLineInfo] [Keep] [KeepDir] [FastMath] [MaxRegCount] [PtxAsOptionV] [SplitCompile] [FastCompile] [TargetMachinePlatform] [NvccCompilation] [CudaRuntime] [AdditionalOptions] [HostDebugInfo] [Emulation] [Defines] -Xcompiler "/EHsc [Warning] /nologo [Optimization] /FS [DebugInformationFormat] [RuntimeChecks] [Runtime] [TypeInfo]" -Xcompiler "/Fdx64\Release\vc143.pdb" [CompileOut] "C:\CudaTest\Test\Test\kernel.cu"" (previous value: ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin\nvcc.exe" [CodeGeneration] --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu [GenerateRelocatableDeviceCode] [ExtensibleWholeProgramCompilation] [Include] [RequiredIncludes] [InterleaveSourceInPTX] [GPUDebugInfo] [GenerateLineInfo] [Keep] [KeepDir] [FastMath] [MaxRegCount] [PtxAsOptionV] [SplitCompile] [FastCompile] [TargetMachinePlatform] [NvccCompilation] [CudaRuntime] [AdditionalOptions] [HostDebugInfo] [Emulation] [Defines] -Xcompiler "/EHsc [Warning] /nologo [Optimization] /FS [DebugInformationFormat] [RuntimeChecks] [Runtime] [TypeInfo]" -Xcompiler "/Fd[ProgramDataBaseFileName]" [CompileOut] "C:\CudaTest\Test\Test\kernel.cu"") at C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 13.1.targets (800,13)
1> Initializing task factory "XamlTaskFactory" from assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1> Using "CudaCompile" task from the task factory "XamlTaskFactory".
1> Task "CudaCompile"
1> cmd.exe /C "C:\Users\AppData\Local\Temp\tmp71b1d1fc96544bc098a24830a0609bfc.cmd"
1> "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin\nvcc.exe" -gencode=arch=compute_75,code=\"sm_75,compute_75\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart hybrid -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /FS /MD " -Xcompiler "/Fdx64\Release\vc143.pdb" -o C:\CudaTest\Test\Test\x64\Release\kernel.cu.obj "C:\CudaTest\Test\Test\kernel.cu"
1>
1> C:\CudaTest\Test\Test>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin\nvcc.exe" -gencode=arch=compute_75,code=\"sm_75,compute_75\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart hybrid -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /FS /MD " -Xcompiler "/Fdx64\Release\vc143.pdb" -o C:\CudaTest\Test\Test\x64\Release\kernel.cu.obj "C:\CudaTest\Test\Test\kernel.cu"
1> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 13.1.targets(803,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin\nvcc.exe" -gencode=arch=compute_75,code=\"sm_75,compute_75\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart hybrid -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /FS /MD " -Xcompiler "/Fdx64\Release\vc143.pdb" -o C:\CudaTest\Test\Test\x64\Release\kernel.cu.obj "C:\CudaTest\Test\Test\kernel.cu"" exited with code 1.
1> Done executing task "CudaCompile" -- FAILED.
1> Done building target "CudaBuildCore" in project "Test.vcxproj" -- FAILED.
1>
1> Done building project "Test.vcxproj" -- FAILED.
1> Done executing task "MSBuild" -- FAILED.
1>
1>Done building project "Test.vcxproj" -- FAILED.
1>
1>Build FAILED.
1>
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 13.1.targets(803,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin\nvcc.exe" -gencode=arch=compute_75,code=\"sm_75,compute_75\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart hybrid -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /FS /MD " -Xcompiler "/Fdx64\Release\vc143.pdb" -o C:\CudaTest\Test\Test\x64\Release\kernel.cu.obj "C:\CudaTest\Test\Test\kernel.cu"" exited with code 1.
1> 0 Warning(s)
1> 1 Error(s)
1>
1>Time Elapsed 00:00:00.89
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 6:24 pm and took 01.590 seconds ==========
Any help is appreciated. Thanks in advance.
