The environment
CLion+Cmake+Mingw
An error log
-- The C compiler identification is unknown
-- Check for working C compiler: D:/MinGW/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/bin/gcc.exe -- broken
CMake Error at D:/Program Files/JetBrains/CLion 2019.2.3/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"D:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
If it is a CPP program, it may be reported again
-- The CXX compiler identification is unknown
why
CMAKE could not check the C Compiler ID for unknown reasons, causing compilation to fail
The solution
Add the following configuration to the cMakelists.txt file to force the Compiler ID to be specified
INCLUDE(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(gcc GNU)
CMAKE_FORCE_CXX_COMPILER(g++ GNU)
Rerun the cmake directive after adding it
Read More:
- Solve the problem of the C compiler identification is unknown or the cxx compiler identification is unknown in the process of using cmake
- The C compiler identification is unknown solution
- The cxx compiler identification is unknown
- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:11 (project):
- ninja Compiling the C compiler identification source file CMakeCCompilerId.c failed
- CMake Error at CMakeLists.txt:5 (PROJECT): The CMAKE_C_COMPILER: cl is not a full path
- [Solved] Linux C++ Compile Error: c++: internal compiler error: Killed (program cc1plus)
- configure: error: C compiler cannot create executables
- C# Compiler Errors
- C++ compiler prompt “undefined reference to…”[How to Fix]
- Configuration: error: no acceptable C compiler found in $path
- configure: error: C compiler cannot create executables See `config.log’ for more details
- configure: error: no acceptable C compiler found in $PATH
- c++ terminate called after throwing an instance of ‘std::system_error‘ what(): Unknown error -1
- Error: no acceptable C compiler found in $path
- Compiler problem, error: ‘for’ loop initial declarations are only allowed in C99 mode
- Install Python C extension compiler environment under windows (solve “error: command” cl.exe ‘ failed: No such file or directory”)
- Stm32f103c8t6 in keil compiler error: # 67: expected a “}” solution
- Fatal error c1859: unexpected precompiled header error. Simply rerun the compiler may fix this problem
- C / C + + cannot open the source file directory, the header file is not imported, the solution is as follows