When vs2017 compiles CUDA project, “error msb6006:“ cmd.exe ”Exited with code 1 Solutions for

Recently, the system was reinstalled because the computer was too jammed. In order to avoid repeating the same mistake, there is almost no software installed in C disk, including VS. However, when using CMAKE to compile CUDA program, there are problems:
Error MSB6006: “cmd.exe” has exited with code 1.
Google found that it should be because the default VS installation path of CUDA is on C disk, so it could not be found. The solution is to find the CUDA_HOST_COMPILER item in cmake-gui and change it to your own compiled path, such as mine:

This should compile properly.

Read More: