本文介绍了如何在Windows上设置cmake CXX变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误

正在处理:Microsoft Windows [Versión6.1.7601]

Working on: Microsoft Windows [Versión 6.1.7601]

错误:

CMake Warning at CMakeLists.txt:4 (project):
  To use the NMake generator, cmake must be run from a shell that can use the
  compiler cl from the command line.  This environment does not contain
  INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
  work.


-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:4 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!

如果有人可以帮忙...

If somone can help...

推荐答案

在运行cmake之前,您需要运行Visual Studio提供的批处理脚本来设置环境。它位于 X:\Visual\Studio\Dir\VC\vcvarsall.bat 下。在 Visual Studio命令提示符的开始菜单中也应该有一个快捷方式,它将打开一个提示并自动运行 vcvarsall.bat

You need to run the batch script provided by Visual Studio to set up your environment before running cmake. It's under X:\Visual\Studio\Dir\VC\vcvarsall.bat. There should also be a shortcut in the start menu for "Visual Studio Command Prompt" that will open a prompt and automatically run vcvarsall.bat.

这篇关于如何在Windows上设置cmake CXX变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 17:54