I have installed CLion on a Windows 10 system and would like to learn how to use it to write and compile C++ programs, but I am seeing errors everf before I can get started. This is a copy of the the error I am seeing in every project I have created or opened:
Error:The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Gil/.CLion12/system/cmake/generated/282db9ba/282db9ba/__default__/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_bec7a/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_bec7a.dir\build.make CMakeFiles/cmTC_bec7a.dir/build
mingw32-make.exe: Entering directory 'C:/Users/Gil/.CLion12/system/cmake/generated/282db9ba/282db9ba/__default__/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_bec7a.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_bec7a.dir\testCCompiler.c.obj -c C:\Users\Gil\.CLion12\system\cmake\generated\282db9ba\282db9ba\__default__\CMakeFiles\CMakeTmp\testCCompiler.c
Linking C executable cmTC_bec7a.exe
"C:\Program Files (x86)\JetBrains\CLion 1.2.4\bin\cmake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_bec7a.dir\link.txt --verbose=1
Error opening link script "CMakeFiles\cmTC_bec7a.dir\link.txt"
CMakeFiles\cmTC_bec7a.dir\build.make:98: recipe for target 'cmTC_bec7a.exe' failed
mingw32-make.exe: *** [cmTC_bec7a.exe] Error 1
mingw32-make.exe: Leaving directory 'C:/Users/Gil/.CLion12/system/cmake/generated/282db9ba/282db9ba/__default__/CMakeFiles/CMakeTmp'
Makefile:125: recipe for target 'cmTC_bec7a/fast' failed
mingw32-make.exe: *** [cmTC_bec7a/fast] Error 2
CMake will not be able to correctly generate this project.
Using SysInternal's Procmon to get a grasp of what is happening I can see a file being created called "CMakeFiles\cmTC_bec7a.dir\link.txt," but it is deleted before the CLion cmake.exe program attempts to open the file.
I think I have the toolchain setup correctly for this, but you can see what I have here:
I have also noticed with procmon.exe that the failing process is looking for link.txt here: c:\CMakeFiles\cmTC_bec7a.dir\link.txt. It appears that instance of cmd.exe that executes this call has a default directory of c:\ while other related processes are run from a cmd.exe that has C:/Users/Gil/.CLion12/system/cmake/generated/282db9ba/282db9ba/__default__/CMakeFiles/CMakeTmp set as the default directory. If that were the case with the failing process, I think it would find that the file was present.
I'm not able to determine why this happens, so your help would be appreciated.