如何安装CMake的C编译器和编译器CXX(How to install Cmake C compi

2019-08-16 21:12发布

我需要一些帮助编译这个项目的cmake。 以下是错误消息。

$ ./build_avida
-- Building for: NMake Makefiles
CMake Warning at CMakeLists.txt:1 (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.


CMake Error: CMake was unable to find a build program corresponding to "NMake Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:C:/Users/Desk/Dropbox/2012-2013/BCB504/AvidaProject/avidagit/avida/CMakeFiles/2.8.10.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/Users/Desk/Dropbox/2012-2013/BCB504/AvidaProject/avidagit/avida/CMakeFiles/2.8.10.2/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
make: *** No rule to make target `install'.  Stop.

Answer 1:

尝试安装gccgcc-c++ ,因为CMake的工作顺利它们。

基于红帽

yum install gcc gcc-c++

- 基于Ubuntu是Debian /

apt-get install cmake gcc g++

然后,

  1. 删除“CMakeCache.txt”
  2. 再次运行编译。


Answer 2:

我使用的方法是启动“Visual Studio命令提示符”,可以在开始菜单中找到。 例如,我的Visual Studio 2010速成安装有shortcute Visual Studio Command Prompt (2010)Start Menu\Programs\Microsoft Visual Studio 2010\Visual Studio Tools

此快捷方式调用的脚本编写环境vcvarsall.bat其中编译器,链接等都是从右边Visual Studio安装设置。

或者,如果你已经有一个提示开放,你可以通过调用一个类似的脚本编写环境:

:: For x86 (using the VS100COMNTOOLS env-var)
call "%VS100COMNTOOLS%"\..\..\VC\bin\vcvars32.bat

要么

:: For amd64 (using the full path)
call C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat

然而:

您的输出(用“$”提示符)表明你正试图从一个外壳MSys的运行CMake的。 在这种情况下,它可能会更好的或MSys的MinGW的运行CMake的,通过明确指定一个makefile生成器:

cmake -G"MSYS Makefiles"
cmake -G"MinGW Makefiles"

运行cmake --help获得所有可能生成的列表。



Answer 3:

这些错误:

“CMake的错误:CMAKE_C_COMPILER没有设置,EnableLanguage后

CMake的错误:CMAKE_CXX_COMPILER没有设置,EnableLanguage后”

意味着你还没有安装的mingw32基地。

转到http://sourceforge.net/projects/mingw/files/latest/download?source=files

然后确保你选择“的mingw32基地”

确保你正确设置环境变量PATH中节。 “C:\ MinGW的\ BIN”

打开CMake和选择安装后 - >删除缓存。

并再次点击配置按钮。 我这种方式解决了这个问题,希望你解决这个问题。



文章来源: How to install Cmake C compiler and CXX compiler
标签: cmake