How to install Cmake C compiler and CXX compiler

后端 未结 4 1283
一个人的身影
一个人的身影 2021-02-12 16:25

I need some help compiling this project with cmake. Here is the error message.

$ ./build_avida
-- Building for: NMake Makefiles
CMake Warning at CMakeLists.txt:1         


        
相关标签:
4条回答
  • 2021-02-12 16:34

    Those errors :

    "CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage

    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage"

    means you haven't installed mingw32-base.

    Go to http://sourceforge.net/projects/mingw/files/latest/download?source=files

    and then make sure you select "mingw32-base"

    Make sure you set up environment variables correctly in PATH section. "C:\MinGW\bin"

    After that open CMake and Select Installation --> Delete Cache.

    And click configure button again. I solved the problem this way, hope you solve the problem.

    0 讨论(0)
  • 2021-02-12 16:35

    The approach I use is to start the "Visual Studio Command Prompt" which can be found in the Start menu. E.g. my visual studio 2010 Express install has a shortcute Visual Studio Command Prompt (2010) at Start Menu\Programs\Microsoft Visual Studio 2010\Visual Studio Tools.

    This shortcut prepares an environment by calling a script vcvarsall.bat where the compiler, linker, etc. are setup from the right Visual Studio installation.

    Alternatively, if you already have a prompt open, you can prepare the environment by calling a similar script:

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

    or

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

    However:

    Your output (with the '$' prompt) suggests that you are attempting to run CMake from a MSys shell. In that case it might be better to run CMake for MSys or MinGW, by explicitly specifying a makefile generator:

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

    Run cmake --help to get a list of all possible generators.

    0 讨论(0)
  • 2021-02-12 16:36

    Even though I had gcc already installed, I had to run

    sudo apt-get install build-essential
    

    to get rid of that error

    0 讨论(0)
  • 2021-02-12 16:53

    Try to install gcc and gcc-c++, as Cmake works smooth with them.

    RedHat-based

    yum install gcc gcc-c++
    

    Debian/Ubuntu-based

    apt-get install cmake gcc g++
    

    Then,

    1. remove 'CMakeCache.txt'
    2. run compilation again.
    0 讨论(0)
提交回复
热议问题