CMake does not find Visual C++ compiler

前端 未结 27 2200
小鲜肉
小鲜肉 2020-11-29 18:51

After installing Visual Studio 2015 and running CMake on a previous project, CMake errors stating that it could not find the C compiler.

The C compiler ident         


        
相关标签:
27条回答
  • 2020-11-29 19:22

    Those stumbling with this on Visual Studio 2017: there is a feature related to CMake that needs to be selected and installed together with the relevant compiler toolsets. See the screenshot below.

    0 讨论(0)
  • 2020-11-29 19:22

    Because CMake is not able to find your Visual Studio compiler. Start any project which will download the required compilers and CMake must be able to find it then.

    0 讨论(0)
  • 2020-11-29 19:25

    A couple of tips:

    • Try to set the path manually by checking 'advanced' and modifying CMAKE_LINKER and CMAKE_MAKE_PROGRAM
    • Delete the cache - in the CMake with GUI go to: File → Delete Cache.

    My problem was a combination of previously stated: I have set the compiler version to 15 instead of 14 and when corrected, I had to delete the cache.

    I also started the Visual Studio command prompt as an administrator and from there I ran the cmake-gui.exe

    Then everything worked as it was supposed to.

    0 讨论(0)
  • 2020-11-29 19:28

    None of the previous solutions worked for me. However I noticed that although I installed Visual Studio version 15 (not to be confused with Visual Studio 2015) the directory created on my computer was for Visual Studio 14.

    When I specified Visual Studio 14 when I pressed the configuration button it worked.

    0 讨论(0)
  • 2020-11-29 19:28

    Check name folder too long or not.

    0 讨论(0)
  • 2020-11-29 19:30

    In my case I could see in the CMakeError.log that CMake could not find the Windows SDK (MSB8003: Could not find WindowsSDKDir variable from the registry).

    The version can be specified on the commandline on the first CMake run using:

    -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=
    

    I got further after setting that, but I hit more issues later (so I assume my environment is messed up somehow), but maybe it will help someone with this issue.

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