MSB3721 Build error CUDA 10.1 Visual Studio 2019

Hi Dear Developers!

The error occurs when I open the sample code “nbody” in visual studio and build it. I confirmed that the environment was built by installing CUDA10.1

  • Severity Code Description Project File Line Suppression State Suppression State Error MSB3721 The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_30,code=\"sm_30,compute_30\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_37,code=\"sm_37,compute_37\" -gencode=arch=compute_50,code=\"sm_50,compute_50\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" -gencode=arch=compute_60,code=\"sm_60,compute_60\" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_70,code=\"sm_70,compute_70\" -gencode=arch=compute_75,code=\"sm_75,compute_75\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64" -x cu -I./ -I../../common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\/include" -I../../common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler "/wd 4819" -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler "/EHsc /W3 /nologo /O2 /Fdx64/Release/vc142.pdb /FS /Zi /MT " -o x64/Release/ "C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\5_Simulations\nbody\"" exited with code 2. nbody C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 10.1.targets 764

I use a Japanese PC, so the backslash is converted to Yen, but that doesn’t seem to be a problem.
I spent 3 days to stop this hateful error: MSB3721 had many posts in the major, but I didn’t find anything that matched this error.

My laptop spec and each application version

rtx 2060


Visual Studio 2019
CUDA 10.1

I pay tribute to your cooperation.

This directory is wrong “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1/include”. note the / at the end.

I am also running into a lot of trouble getting Cuda 10.2 to run with Visual Studio 2019. The installation program seems to have a lot of issues.

Can you help me solve this error:

|Error|MSB3721|The command C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe -gencode=arch=compute_30,code=\sm_30,compute_30\ -gencode=arch=compute_75,code=\sm_75,compute_75\ –use-local-env -ccbin C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64 -x cu -I\include -IC:\opencv_3.0\opencv\build\include -I…..\include -I…..\3rdparty\stb\include -I…..\3rdparty\pthreads\include -IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include -IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include -I\include -I\include -IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -DCUDNN -DGPU -DLIB_EXPORTS -D_TIMESPEC_DEFINED -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32 -DNDEBUG -D_CONSOLE -D_LIB -D_WINDLL -D_MBCS -Xcompiler /EHsc /W3 /nologo /O2 /Fdx64\DLL_Release\vc142.pdb /FS /Zi /MD -o x64\DLL_Release\ C:\Users\user\Downloads\darknet\darknet\src\ exited with code 1.|yolo_cpp_dll|C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 10.2.targets|764||

Thanks in advance

1 Like

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 MSB3721 命令
““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc.exe” -gencode=arch=compute_52,code="sm_52,compute_52"
–use-local-env -ccbin
“C:\Program Files (x86)\Microsoft Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64” -x cu
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include"
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include"
–keep-dir x64\Debug
–machine 64
-cudart static
-g -DWIN32 -DWIN64
-Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc142.pdb /FS /Zi /RTC1 /MDd "
-o D:\vsproject\CudaRuntime2\x64\Debug\ “D:\vsproject\CudaRuntime2\””已退出,返回代码为 1。
CudaRuntime2 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.7.targets 790

i alse have the qusesiont
my hardwar is mx350 vs2019 and cuda 11.7