nvcc致命:找不到Visual Studio配置文件'vsvars32.bat'(VS 2017)

时间:2019-02-21 09:07:54

标签: c++ visual-studio cuda

我正在尝试在Visual Studio 2017中构建cuda / c ++程序。可能值得注意的是,我的计算机还安装了VS 2013。我尝试将vsvars32.bat放在与VS 2013相同的目录中,但错误没有改变。由于x64/../../..

,我不知道应该去哪里
>------ Build started: Project: CMakeLists, Configuration: Debug ------
  [1/5] cmd.exe /C "cd /D "D:\Users\adm_lab\CMakeBuilds\3f75e69e-932c-9435-a942-a027b1514a1d\build\x64-Debug (default)\CMakeFiles\voxelizer.dir" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E make_directory "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//." && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -D verbose:BOOL=OFF -D build_configuration:STRING=Debug -D "generated_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj" -D "generated_cubin_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj.cubin.txt" -P "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//voxelizer_generated_main.cu.obj.Debug.cmake""
  FAILED: CMakeFiles/voxelizer.dir/voxelizer_generated_main.cu.obj 
  cmd.exe /C "cd /D "D:\Users\adm_lab\CMakeBuilds\3f75e69e-932c-9435-a942-a027b1514a1d\build\x64-Debug (default)\CMakeFiles\voxelizer.dir" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E make_directory "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//." && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -D verbose:BOOL=OFF -D build_configuration:STRING=Debug -D "generated_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj" -D "generated_cubin_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj.cubin.txt" -P "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//voxelizer_generated_main.cu.obj.Debug.cmake""
  nvcc fatal   : Visual Studio configuration file 'vsvars32.bat' could not be found for installation at 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/../../..'
  CMake Error at voxelizer_generated_main.cu.obj.Debug.cmake:219 (message):
    Error generating
    D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug
    (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj


  ninja: build stopped: subcommand failed.

Build failed.

编辑:以为我应该补充一点,这台计算机没有Internet连接,因此我使用概述here的本地缓存方法来安装VS。

1 个答案:

答案 0 :(得分:1)

请仔细检查您的Visual Studio 2017实例是否为最新。然后通过Visual Studio安装程序修复Visual Studio实例:

  1. 启动 Visual Studio安装程序
  2. 单击Visual Studio 2017安装前的详细信息图标,然后单击修复

阅读Microsoft Docs | Repair Visual Studio了解更多信息。