5

我正在使用 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

构建日志:

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 ==========

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

1>------ Skipped Build: Project: bandwidthTest ------
1> 
========== Build: 0 succeeded or up-to-date, 0 failed, 1 skipped ==========

我是 C++ 新手,从事 C# 已经有一段时间了。我确定我缺少一些小东西,但是您可以提供的任何线索将不胜感激。

4

3 回答 3

2

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

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

于 2010-01-05T14:22:26.837 回答
2

您正在关注错误的错误消息。

.obj 文件不存在,因为 nvcc 编译步骤失败。

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/../..'
于 2010-01-05T21:06:06.530 回答
1

You need to make sure that all the tools match. So if you have the 64-bit Visual Studio compiler installed then you should install the 64-bit version of the CUDA toolkit.

If you only have the 32-bit Visual Studio compiler, then you should be able to install the 32-bit CUDA toolkit. Ideally you would install all the 64-bit tools. Then you will be able to build both the 64-bit and 32-bit (cross-compile) examples.

于 2010-01-05T16:41:57.290 回答