CLion: Error:The C compiler “C:/MinGW/bin/gcc.exe” is not able to compile a simple test program

后端 未结 2 495
傲寒
傲寒 2021-01-02 03:35

I\'m trying to run CLion on windows 7 with MinGW but for some reason CMake can\'t compile the simple test program but when I create a simple hello world file it compiles jus

相关标签:
2条回答
  • 2021-01-02 04:12

    With a dummy cmake project (A CMakeLists.txt with simply cmake_minimum_required(VERSION 2.8) and add_executable(helloWorld <your hello world program>).), we have established that the compiler and CLion are not the problem, so it's probably something to do with make. Here was the log.

    My guess is that you have msys in your path. If sh.exe is in your path, it is known to cause problems.

    As a safe alternative, you can decide to use ninja as an alternative to make (cmake supports it experimentally, but in practice it supports it pretty well). Here you can find prebuilt packages (in fact, it's just one executable you have to put in your path).

    Ninja integration within CLion should work just fine.

    0 讨论(0)
  • 2021-01-02 04:37

    I had a similar problem. Did you have MinGW installed before CLion?

    If you only installed the C compiler with MinGW (base), there's a chance CLion is testing a non-existent C++ compiler.

    You should try installing the MinGW C++ compiler from its installation manager. Or you can simply delete the C:\MinGW folder, and launch the installer again this time adding both C and C++ compilers. If it doesn't work, try re-installing CLion.

    That's a quick solution that worked for me.

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