My clion's cmake occurs error

已完成

Hello, I'm a novice.
I could compile and run with Clion until yesterday. But after I started a new project yesterday, Clion had a problem, and it was strange that the old project could compile and run. I found a lot of ways from the network, and also didn't solve it. It was so annoying, and then I unloaded and reloaded Clion and MinGW, and Clion went on strike. I hope to be able to get professional advice on how to solve this problem. The specific errors are as follows:

"D:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=D:/Program Files/mingw64/bin/mingw32-make.exe" "-DCMAKE_C_COMPILER=D:/Program Files/mingw64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER=D:/Program Files/mingw64/bin/g++.exe" -G "CodeBlocks - MinGW Makefiles" "E:\C_C++ code\Clion_C_1\test1"
-- The C compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/Program Files/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/Program Files/mingw64/bin/gcc.exe -- broken
CMake Error at D:/Program Files/JetBrains/CLion 2019.2.5/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"D:/Program Files/mingw64/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: E:/C_C++ code/Clion_C_1/test1/cmake-build-debug-mingw/CMakeFiles/CMakeTmp

Run Build Command(s):D:/Program Files/mingw64/bin/mingw32-make.exe cmTC_38bf2/fast && D:/Program Files/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_38bf2.dir\build.make CMakeFiles/cmTC_38bf2.dir/build
mingw32-make.exe[1]: Entering directory 'E:/C_C++ code/Clion_C_1/test1/cmake-build-debug-mingw/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_38bf2.dir/testCCompiler.c.obj
"D:\Program Files\mingw64\bin\gcc.exe" -o CMakeFiles\cmTC_38bf2.dir\testCCompiler.c.obj -c "E:\C_C++ code\Clion_C_1\test1\cmake-build-debug-mingw\CMakeFiles\CMakeTmp\testCCompiler.c"
Linking C executable cmTC_38bf2.exe
"D:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_38bf2.dir\link.txt --verbose=1
"D:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_38bf2.dir/objects.a
"D:\Program Files\mingw64\bin\ar.exe" cr CMakeFiles\cmTC_38bf2.dir/objects.a @CMakeFiles\cmTC_38bf2.dir\objects1.rsp
"D:\Program Files\mingw64\bin\gcc.exe" -Wl,--whole-archive CMakeFiles\cmTC_38bf2.dir/objects.a -Wl,--no-whole-archive -o cmTC_38bf2.exe -Wl,--out-implib,libcmTC_38bf2.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\cmTC_38bf2.dir\linklibs.rsp
D:/Program Files/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find @C:\WINDOWS\TEMP\cc2REQgK: Invalid argument
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_38bf2.dir\build.make:88: cmTC_38bf2.exe] Error 1
mingw32-make.exe[1]: Leaving directory 'E:/C_C++ code/Clion_C_1/test1/cmake-build-debug-mingw/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:120: cmTC_38bf2/fast] Error 2

 

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)

0

Hello!

It's unclear what's going on. Have you tried reinstalling MinGW completely and setting it up as described here https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#MinGW?

0

Anna,I reload MinGW after Clion broken.I use cmd to review gcc's version,and show MinGW working well.Today,according to you advise and i follow quick Toutor configuring Clion mehton ,problem still exsises.By the way,i choose download Compression package from mingw-w64.org because my net online install mingw by mingw setup.exe always faild.

 

0

It looks like something is wrong with your MinGW distribution. I'd suggest to download MinGW-W64-install.exe and install MinGW-w64 using it.

0

Anna,i have install MinGW-W64,and set enviroment path.Mingw itself is not problem. But there is a new problem.

Anna,I'm really want to cry!!!I'm about to run!!!!

cmake report a error:

-- The C compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/Program Files/mingw64/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/Program Files/mingw64/mingw64/bin/gcc.exe -- broken
CMake Error at D:/Program Files/JetBrains/CLion 2019.2.5/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"D:/Program Files/mingw64/mingw64/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: E:/C_C++ code/C_Primer_Plus/P6/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):D:/Program Files/mingw64/mingw64/bin/mingw32-make.exe cmTC_e054d/fast && D:/Program Files/mingw64/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_e054d.dir\build.make CMakeFiles/cmTC_e054d.dir/build
mingw32-make.exe[1]: Entering directory 'E:/C_C++ code/C_Primer_Plus/P6/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e054d.dir/testCCompiler.c.obj
"D:\Program Files\mingw64\mingw64\bin\gcc.exe" -o CMakeFiles\cmTC_e054d.dir\testCCompiler.c.obj -c "E:\C_C++ code\C_Primer_Plus\P6\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c"
Linking C executable cmTC_e054d.exe
"D:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_e054d.dir\link.txt --verbose=1
"D:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_e054d.dir/objects.a
"D:\Program Files\mingw64\mingw64\bin\ar.exe" cr CMakeFiles\cmTC_e054d.dir/objects.a @CMakeFiles\cmTC_e054d.dir\objects1.rsp
"D:\Program Files\mingw64\mingw64\bin\gcc.exe" -Wl,--whole-archive CMakeFiles\cmTC_e054d.dir/objects.a -Wl,--no-whole-archive -o cmTC_e054d.exe -Wl,--out-implib,libcmTC_e054d.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\cmTC_e054d.dir\linklibs.rsp
D:/Program Files/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find @C:\WINDOWS\TEMP\ccaVG56x: Invalid argument
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_e054d.dir\build.make:88: cmTC_e054d.exe] Error 1
mingw32-make.exe[1]: Leaving directory 'E:/C_C++ code/C_Primer_Plus/P6/cmake-build-debug/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:120: cmTC_e054d/fast] Error 2

 

CMake will not be able to correctly generate this project.

  

0

Hi,

Can you please try compiling any C++ file using MinGW gcc directly from command line?

For this you have to first add path to MinGW bin directory into PATH variable. E.g. using this command

`set PATH="D:\Program Files\mingw64\mingw64\bin";%PATH%`

Then run gcc using command `gcc main.cpp` where file `main.cpp` you can take from the newly created CLion project. This will allow us to better understand where's the poblem

0

Semyon Kolton,I can compiling C program from cmd by GCC command,and i have set MinGW bin into PATH variable already.It's seem everything done well.But Clion alway report Cmake error.I confused about everyting goes well before till i create C project 7-"P7".when i were codeing for P7,other files still could run,and i searched method from net a lot but could not  solved P7's problem.I attempted to unload and reload Clion and MinGW.

    

0

Does the issue happen only for your "P7" project now? Or for all projects?

0

Anna Falevskaya this issue had happend after i created P7 firstly.I attempted to run P6,and worked well,i am sure that problem was only happen for P7.After i reload Clion, problem is exsis in every project,including those the past is normal.

0

Anna Falevskaya ,Semyon Kolton. I trying to use DEV-c++'s bin directory.I find that camke do not report error.Clion can work and complier C programes .I am happy to slove this issue.But i have a question why i download MinGW from MinGW.org or intasll MinGW by intasll.exe application are useless for several times even thorogh cmd show gcc and g++ well.In the end ,thank for your efforts and help. 

0

I'm glad you solved the issue!

>But i have a question why i download MinGW from MinGW.org or intasll MinGW by intasll.exe application are useless for several times even thorogh cmd show gcc and g++ well.

I'm afraid we can't answer that. For example, on my side MinGW installed using MinGW-W64-install.exe works correctly. So it seems to be a specific issue with a particular installation and setup rather than a CLion related issue.

0

请先登录再写评论。