编译CUDA示例会产生构建错误

Mr *_*ell 5 c++ cuda visual-studio-2008

我使用Visual Studio 2008运行Windows 7 64位.我安装了CUDA驱动程序和SDK.SDK附带了很多示例,包括已编译的可执行文件和源代码.编译后的可执行文件运行得非常好.当我打开vc90解决方案并开始构建Win32配置时,我收到此错误:

Error   1   fatal error LNK1181: cannot open input file '.\Release\bandwidthTest.cu.obj'    bandwidthTest   bandwidthTest
Run Code Online (Sandbox Code Playgroud)

构建日志:

1>------ Build started: Project: bandwidthTest, Configuration: Release Win32 ------
1>Compiling with CUDA Build Rule...
1>"C:\CUDA\bin64\nvcc.exe"    -arch sm_10 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  " -I"C:\CUDA\include" -I"../../common/inc" -maxrregcount=32  --compile -o "Release\bandwidthTest.cu.obj" "c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu" 
1>nvcc fatal   : Visual Studio configuration file '(null)' could not be found for installation at 'c:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/../..'
1>Linking...
1>LINK : fatal error LNK1181: cannot open input file '.\Release\bandwidthTest.cu.obj'
1>Build log was saved at "file://c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\Release\BuildLog.htm"
1>bandwidthTest - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)

如果我尝试在x64中编译它根本不构建,只是跳过项目

1>------ Skipped Build: Project: bandwidthTest ------
1> 
========== Build: 0 succeeded or up-to-date, 0 failed, 1 skipped ==========
Run Code Online (Sandbox Code Playgroud)

我是C++的新手,已经做了一段时间的C#.我肯定有一些我想念的小东西,但你能提供的任何线索都会受到赞赏.

bee*_*ann 2

检查您是否安装了 x64 编译器。然后将项目类型更改为 x64。我在尝试用64位win7编译32位cuda程序时遇到了同样的问题。

另请确保您已将 64 位库添加到搜索路径中。