编译CUDA示例会产生构建错误 [英] Compiling CUDA examples gives build error
问题描述
我运行Windows 7 64位,使用Visual Studio 2008.我安装了CUDA驱动程序和SDK。 SDK附带了很多例子,包括编译的可执行文件和源代码。编译的可执行文件运行奇妙。当我打开vc90解决方案,去建立在Win32配置我得到这个错误:
I am running Windows 7 64bit, with Visual Studio 2008. I installed the CUDA drivers and SDK. The SDK comes with quite a few examples including compiled executables and source code. The compiled executables run wonderfully. When I open the vc90 solutions and go to build in Win32 configuration I get this error:
Error 1 fatal error LNK1181: cannot open input file '.\Release\bandwidthTest.cu.obj' bandwidthTest bandwidthTest
构建日志: / p>
Build log:
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中编译它不会构建,只是跳过项目
If I attempt to compile in x64 it doesn't build at all and just skips the project
1>------ Skipped Build: Project: bandwidthTest ------
1>
========== Build: 0 succeeded or up-to-date, 0 failed, 1 skipped ==========
我是C ++的新手,一直在做C#。
I am new to C++, having been doing C# for a while. I'm certain there is something small that I am missing, but any clues you could provide would be appreciated.
推荐答案
检查是否有可能提供的线索你安装了x64编译器。然后将项目类型更改为x64。我有同样的问题,当试图编译32位的cuda程序与64位win7。
Check if you have x64 compiler installed. Then change project type to x64. I had the same problem when trying to compile 32bit cuda program with 64bit win7.
此外,请确保已添加64位库,并包含到搜索路径中。
Also make sure you have added 64bit libs and includes to the search path.
这篇关于编译CUDA示例会产生构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!