libstdc++-6.dll is missing


I have just downloaded CLion and tried to test it. My code runs without any errors. 

I would like to execute the test.exe file without CLion. So I build it with Strg+F9 and then I find the test.exe file in: C:\Users\name\CLionProjects\opl\cmake-build-debug

The problem is if I execute that file, I will get an error from Windows that the file libstdc++-6.dll is missing. What am I doing wrong?


If you are using MingW to compile C++ code on Windows, you may like to add the options -static-libgcc and -static-libstdc++ to link the C and C++ standard libraries statically and thus remove the need to carry around any separate copies of those. Version management of libraries is a pain in Windows.


Thank you for your answer. How exactly do I add -static-libgcc and -static-libstdc++? Sorry, I am very new to this.


You can add them to `CMAKE_<LANG>_FLAGS` (See e.g here or add `<path_to_mingw>\bin` to the PATH before running binary.



i had the same problem


set(CMAKE_EXE_LINKER_FLAGS "-static")    

to the cmakelists fixed it .


For CMake3.X+, use this instead

target_link_libraries(your_target_name -static)



I added target_link_libraries(your_target_name -static) to cmakelists.txt and now I no longer get the libstdc++-6.dll is missing error when running the .exe (windows 11 console program) but the console program starts up, prompts the first prompt and then dies - process disappears from Windows task manager.

Please help.


Mike Gold sorry for the delay in response. Do you still experience the issue? Is it possible that the program just finishes?


Thanks Aliachour *kiss* *kiss* *muuahh* luv u :3.