我用的是CUDA 7.0 和VS 2013。编译模版程序时生成这个错误:
1> Compiling CUDA source file kernel.cu...
1>
1> C:\>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static /FS -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd /FS" -o Debug\kernel.cu.obj "C:\CUDA\test\test\kernel.cu"
1> nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 7.0.targets(593,9): error MSB3721: The command “"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static /FS -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd /FS" -o Debug\kernel.cu.obj "C:\CUDA\test\test\kernel.cu"” exited with code 1.
参考这个帖子 nvcc fatal : A single input file is required for a non-link phase when an output file is specified,应该是生成的/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd /FS
是错误的,那应该怎么避免这个问题?
业精于勤,荒于嬉;行成于思,毁于随。