CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found

后端 未结 19 2155
抹茶落季
抹茶落季 2020-11-22 12:57

I\'m trying make a Visual Studio solution with CMake to compile the latest version of aseprite and CMake keeps giving me the:

No CMAKE_C_COMPILER could be fo         


        
相关标签:
19条回答
  • 2020-11-22 13:40

    I updated Visual Studio 2015 update 2 to Visual Studio 2015 update 3, and it solved my problem.

    0 讨论(0)
  • 2020-11-22 13:40

    For me it worked to use the Developer Command Prompt that comes with Visual Studio and then just cd to your/jcef/dir and run cmake -G "Visual Studio 14 Win64" ..

    0 讨论(0)
  • 2020-11-22 13:40

    I know this question is about visual studio 2015. I faced this issue with visual studio 2017. When searched on google I landed to this page. After looking at first 2,3 answers I realized this is the problem with vc++ installation. Installing the workload "Desktop development with c++" resolved the issue.

    0 讨论(0)
  • 2020-11-22 13:43

    I get exactly the reported error if ccache is enabled, when using CMake's Xcode generator. Disabling ccache fixed the problem for me. Below I present a fix/check that works for MacOS, but should work similarly on other platforms.

    Apparently, it is possible to use CMake's Xcode generator (and others) also in combination with ccache, as is described here. But I never tried it out myself.

    # 1) To check if ccache is enabled:
    echo $CC
    echo $CXX
    # This prints something like the following: 
    #     ccache clang -Qunused-arguments -fcolor-diagnostics. 
    # CC or CXX are typically set in the `.bashrc` or `.zshrc` file.
    
    # 2) To disable ccache, use the following:
    CC=clang
    CXX=clang++
    
    # 3) Then regenerate the cmake project
    cmake -G Xcode <path/to/CMakeLists.txt>
    
    0 讨论(0)
  • 2020-11-22 13:46

    I ran into this issue while building libgit2-0.23.4. For me the problem was that C++ compiler & related packages were not installed with VS2015, therefore "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" file was missing and Cmake wasn't able to find the compiler.

    I tried manually creating a C++ project in the Visual Studio 2015 GUI (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe) and while creating the project, I got a prompt to download the C++ & related packages.

    After downloading required packages, I could see vcvarsall.bat & Cmake was able to find the compiler & executed successfully with following log:

    C:\Users\aksmahaj\Documents\MyLab\fritzing\libgit2\build64>cmake ..
    -- Building for: Visual Studio 14 2015
    -- The C compiler identification is MSVC 19.0.24210.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual        
    Studio 14.0/VC/bin/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual  
    Studio 14.0/VC/bin/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
    -- Could NOT find ZLIB (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
    -- zlib was not found; using bundled 3rd-party sources.
    -- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of 
    the default search path.
    -- Looking for futimens
    -- Looking for futimens - not found
    -- Looking for qsort_r
    -- Looking for qsort_r - not found
    -- Looking for qsort_s
    -- Looking for qsort_s - found
    -- Looking for clock_gettime in rt
    -- Looking for clock_gettime in rt - not found
    -- Found PythonInterp: C:/csvn/Python25/python.exe (found version "2.7.1")
    -- Configuring done
    -- Generating done
    -- Build files have been written to:    
    C:/Users/aksmahaj/Documents/MyLab/fritzing/libgit2/build64
    
    0 讨论(0)
  • 2020-11-22 13:48

    I also experienced this error when working with CMake:

    No CMAKE_C_COMPILER could be found.
    No CMAKE_CXX_COMPILER could be found.
    

    The 'warning' box in the MSDN library article Visual C++ in Visual Studio 2015 gave me the help that I needed.

    Visual Studio 2015 doesn't come with C++ installed by default. So, creating a new C++ project will prompt you to download the necessary C++ components.

    0 讨论(0)
提交回复
热议问题