CMake does not find Visual C++ compiler

前端 未结 27 2196
小鲜肉
小鲜肉 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:10

    If you are on Visual Studio 2017 you need at least CMake 3.8!

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

    Resolved by adding the missing component Modify->continue add as follow Fix

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

    I have found the solution. While the Visual Studio IDE installed successfully it did not install any build tools and therefore did not install the C++ compiler.

    By attempting to manually create a C++ project in the Visual Studio 2015 GUI I was able to prompt it to download the C++ packages. CMake was then able to find the compiler without any difficulty.

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

    This might be another solution for those with the latest Windows 10 creator version:

    Stack Overflow post Fatal error LNK1104: cannot open file 'gdi32.lib'

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

    For me, I checked the CMakeError.log file and found:

    [...] error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".

    This is despite using Visual Studio 2017 on Windows 7. So it appears that CMake is trying to build its detection project with the Windows 8.1 SDK.

    I used the Visual Studio installer to add that component and now CMake is happy as a clam.

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

    Here is the solution that worked for me:

    1. Open Visual Studio command prompt tool (as an administrator). On windows 10 it might be called 'Developer command prompt'.
    2. Navigate to where you have the CMake executable
    3. Run Cmake.exe
    4. Proceed as usual to select build and source folder
    5. Select the appropriate Visual Studio compiler and hit the configure button

    Hopefully it should run without problems.

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