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

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

your computer. Try reinstalling the program to fix this problem

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

解决方法

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

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

程序便可以执行

posted @ 2017-03-25 21:57  liutianchen  阅读(9506)  评论(0编辑  收藏  举报