The exe file compiled by CLion cannot run normally under windows

Reason : The program compiled with CLion is compiled with the cmake method, and the exe file on windows needs libgcc to run

Error:

Modify the CMAKElist file, add:

set(CMAKE_EXE_LINKER_FLAGS "-static")

Or add: Modify the CMAKElist file and add instructions for the linker to statically link libgcc and libstdc++

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

or add:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

or add:

set(CMAKE_EXE_LINKER_FLAGS "-static")

As shown in the picture:

 

 

Guess you like

Origin blog.csdn.net/Stupid__Angel/article/details/130263342