在Windows下使用Mingw32编译,Clion 执行CMake时报错:
D:\Develop\CLion-2021.1.3.win\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" D:\Work\C++Work\HelloWorld -- The C compiler identification is GNU 8.1.0 -- The CXX compiler identification is GNU 8.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Develop/i686-8.1.0-release-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Develop/i686-8.1.0-release-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: D:/Work/C++Work/HelloWorld/cmake-build-debug-mingw-810 Cannot read D:\Work\C++Work\HelloWorld\cmake-build-debug-mingw-810\CMakeFiles\TargetDirectories.txt[Failed to reload]
发现Clion默认情况下使用的生成构建文件风格是“CodeBlocks”, 尝试去掉CodeBlocks后发现可以正常构建。
电脑中装了公司加密软件,可能和加密软件有关系...
在Clion配置中CMake下添加参数:
-G "MinGW Makefiles"