1. 程式人生 > >The C compiler identification is unknown No CMAKE_C_COMPILER could be found

The C compiler identification is unknown No CMAKE_C_COMPILER could be found

技術 多版本 直接 tps studio sts ima cat 選項

當前系統環境:

1、Windows 7中文旗艦版

2、Visual studio 2017、Visual studio 2019

3、Cmake 3.8.1

報錯信息:

The C compiler identification is unknown

The CXX compiler identification is unknown

CMake Error at CMakeLists.txt:3 (project):

No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:3 (project):

No CMAKE_CXX_COMPILER could be found

.

解決辦法:

1、確保安裝VS時,安裝了C++的編譯器(可用VS直接新建工程並查看編譯是否通過來測試);

2、安裝選項勾選Windows 8.1 SDK 和 UCRT SDK(默認是不勾選的)

技術分享圖片

3、確保VS多版本共存時,選擇了正確的編譯版本。

相關問題鏈接:

https://stackoverflow.com/questions/32801638/cmake-error-at-cmakelists-txt30-project-no-cmake-c-compiler-could-be-found

The C compiler identification is unknown No CMAKE_C_COMPILER could be found