libstdc++-6.dll is missing

Answered

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?

0
8 comments

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.

0

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

0

You can add them to `CMAKE_<LANG>_FLAGS` (See e.g here https://ecrafter.wordpress.com/2012/04/24/cmake-tutorial-part-2/) or add `<path_to_mingw>\bin` to the PATH before running binary.

 

1

i had the same problem

adding

set(CMAKE_EXE_LINKER_FLAGS "-static")    

to the cmakelists fixed it .

12

For CMake3.X+, use this instead

target_link_libraries(your_target_name -static)

 

1

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.

0

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

0

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

0

Please sign in to leave a comment.