2010-01-05 83 views
5

我使用Visual Studio 2008運行Windows 7 64位。我安裝了CUDA驅動程序和SDK。 SDK包含了很多例子,包括編譯後的可執行文件和源代碼。編譯好的可執行文件運行良好。當我打開VC90解決方案,去建立在Win32中的配置我得到這個錯誤:編譯CUDA示例給出構建錯誤

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

如果我試圖在64位編譯它並不建立在所有和只是跳過項目

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

我是C++新手,一直在做C#一段時間。我確信有一些我很想念的東西,但任何你可以提供的線索都會被讚賞。

回答

2

檢查您是否安裝了x64編譯器。然後將項目類型更改爲x64。當試圖用64位win7編譯32位cuda程序時,我遇到了同樣的問題。

此外請確保您已添加64位庫幷包含到搜索路徑中。

1

您需要確保所有工具匹配。因此,如果您安裝了64位Visual Studio編譯器,那麼您應該安裝64位版本的CUDA工具包。

如果您只有32位Visual Studio編譯器,那麼您應該可以安裝32位CUDA工具包。理想情況下,你會安裝所有的64位工具。然後,您將能夠構建64位和32位(交叉編譯)示例。

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/../..'