编译 CUDA 示例出现构建错误

2023-11-25

我运行的是 Windows 7 64 位,带有 Visual Studio 2008。我安装了 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# 一段时间了。我确信我缺少一些小东西,但是您能提供的任何线索将不胜感激。


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

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

编译 CUDA 示例出现构建错误 的相关文章

随机推荐