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

后端 未结 19 2095
抹茶落季
抹茶落季 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:32

    Look in the Cmakelists.txt if you find ARM you need to install C++ for ARM

    It's these packages:

    C++ Universal Windows Platform for ARM64 "Not Required"

    Visual C++ Compilers and libraries for ARM "Not Required"

    Visual C++ Compilers and libraries for ARM64 "Very Likely Required"

    Required for finding Threads on ARM 
    enable_language(C) 
    enable_language(CXX)
    

    Then the problems

    No CMAKE_C_COMPILER could be found.

    No CMAKE_CXX_COMPILER could be found.

    Might disappear unless you specify c compiler like clang, and maybe installing clang will work in other favour.

    You can with optional remove in cmakelists.txt both with # before enable_language if you are not compiling for ARM.

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

    This works for me in Ubuntu 17.10 (Artful Aardvark):

    apt-get update
    apt-get install build-essential
    
    0 讨论(0)
  • 2020-11-22 13:35

    For Ubuntu, please install the below things:

    sudo apt-get update && sudo apt-get install build-essential
    
    0 讨论(0)
  • 2020-11-22 13:36

    This happened to me after I installed Visual Studio 15 2017.

    The C++ compiler for Visual Studio 14 2015 was not the problem. It seemed to be a problem with the Windows 10 SDK.

    Adding the Windows 10 SDKs to Visual Studio 14 2015 solved the problem for me.

    See attached screenshot.

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

    For me, this problem went away on Windows when I moved my project to a shallower parent directory, i.e. to:

    C:\Users\spenc\Desktop\MyProjectDirectory

    instead of

    C:\Users\spenc\Desktop\...\MyProjectDirectory.

    I think the source of the problem was that MSBuild has a file path length restriction to 260 characters. This causes the basic compiler test CMake performs to build a project called CompilerIdCXX.vcxproj to fail with the error:

    C1083: Cannot open source file: 'CMakeCXXCompilerId.cpp'

    because the length of the file's path e.g.

    C:\Users\spenc\Desktop\...\MyProjectDirectory\build\CMakeFiles\...\CMakeCXXCompilerId.cpp

    exceeds the MAX_PATH restriction.

    CMake then concludes there is no CXX compiler.

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

    Make sure you have selected the correct version of Visual Studio. This is trickier than it seems because Visual Studio 2015 is actually Visual Studio 14, and similarly Visual Studio 2012 is Visual Studio 11. I had incorrectly selected Visual Studio 15 which is actually Visual Studio 2017, when I had 2015 installed.

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