CMake"无法运行MSBUILD.exe"命令错误

Has*_*ani 7 configuration cmake visual-studio opencv3.0

当我想创建visual studio 15(2017)为opencv 3.3.0制作文件时,它给了我这个错误信息:error in configuration process, project files maybe invalid这些:

CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
  The OLD behavior for policy CMP0020 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:85 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:94 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Error at CMakeLists.txt:127 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:
Run Code Online (Sandbox Code Playgroud)

我使用的是Windows 10.有什么问题,如何解决?

kal*_*iya 6

在CMake-gui中:选择源和二进制文件夹并单击"configure"后,它将询问您使用哪个版本的编译器.确保选择正确的一个

例如,如果安装了"Visual Studio 2015"并选择"Visual Studio 2017",则会遇到"无法运行MSBuild命令:"错误.

如果确实选择了错误的,请删除binaries-folder或只使用其他二进制文件夹 - 然后单击configure并选择正确的编译器.