我一直在努力让一些简单的Cuda 5.0示例在使用CMake的Windows 7上运行。我正在运行Windows 7 64位和Visual C ++ Express 2010。
前几天我有这个工作,现在它无法编译,我不太清楚为什么。我通常在* nix环境中进行编码,因此Windows开发环境对我来说不是一个强大的领域。
如果有人可以帮我救出更多的头发,我们将不胜感激。
示例只是Cuda和CMakeLists.txt文件附带的简单vectorAdd.cu文件。为了保持这个帖子的简短,我会推迟放置源文件,因为它有点长。
这是我的CMakeLists.txt文件:
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
PROJECT( vectorAdd )
FIND_PACKAGE( CUDA REQUIRED )
CUDA_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} )
CUDA_ADD_EXECUTABLE( ${CMAKE_PROJECT_NAME} vectorAdd.cu )
当我尝试编译时,我得到了这个输出:
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Build started 2/10/2013 6:24:59 PM.
1>PrepareForBuild:
1> Creating directory "D:\Code\CPlusPlus\Cuda\example_1\Build\Debug\".
1>InitializeBuildStatus:
1> Creating "Win32\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>CustomBuild:
1> Checking Build System
1> CMake does not need to re-run because D:/Code/CPlusPlus/Cuda/example_1/Build/CMakeFiles/generate.stamp is up-to-date.
1>FinalizeBuildStatus:
1> Deleting file "Win32\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild".
1> Touching "Win32\Debug\ZERO_CHECK\ZERO_CHECK.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.07
2>------ Build started: Project: vectorAdd, Configuration: Debug Win32 ------
2>Build started 2/10/2013 6:24:59 PM.
2>InitializeBuildStatus:
2> Creating "vectorAdd.dir\Debug\vectorAdd.unsuccessfulbuild" because "AlwaysCreate" was specified.
2>ComputeCustomBuildOutput:
2> Creating directory "D:\Code\CPlusPlus\Cuda\example_1\Build\CMakeFiles\vectorAdd.dir\Debug\".
2>CustomBuild:
2> Building NVCC (Device) object CMakeFiles/vectorAdd.dir//Debug/vectorAdd_generated_vectorAdd.cu.obj
2>nvcc : fatal error : Could not set up the environment for Microsoft Visual Studio using 'C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/../../common7/Tools/vsvars32.bat'
2> CMake Error at vectorAdd_generated_vectorAdd.cu.obj.cmake:206 (message):
2> Error generating
2> D:/Code/CPlusPlus/Cuda/example_1/Build/CMakeFiles/vectorAdd.dir//Debug/vectorAdd_generated_vectorAdd.cu.obj
2>
2>
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:00.29
3>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
3>Project not selected to build for this solution configuration
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
有人有建议吗?我认为我从工作时间到停止工作的时间都没有改变任何设置。我试过重启和所有这些东西。