CLion编译的exe文件无法在windows下正常运行

时间:2023-03-08 21:58:22

The program cannot start because libgcc_s_dw2-1.dll is missing from

your computer. Try reinstalling the program to fix this problem

CLion编译的exe文件无法在windows下正常运行

原因:使用CLion编译的程序是用cmake方法编译的,在windows上exe文件需要libgcc才能运行

解决方法

修改CMAKElist文件,添加让链接器静态链接libgcc和libstdc++的指令

set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")

程序便可以执行