Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is missing from computer.

I have all the SDL dlls, but why is this error happening?

share|improve this question

In the linker options add -static-libgcc or -static-libstdc++ ( -static-libgcc worked for me )

Alternatively add the libstdc++6.dll from the compiler bin folder to the folder where your exe resides.( Assuming we are talking about MingW/Gcc it's in mingw/bin/)

share|improve this answer

Often when you run a program inside an IDE it sets a specific 'working directory' where it looks for your DLLs. This may not be the same directory as where your executable is located.

To fix this, you usually need to do the following:

  • Ensure the exe is being output in the place you want (usually under the project's output or linker settings)
  • Move all DLLs to that place (do this yourself, via Explorer etc)
  • Ensure the IDE runs the exe from that location (usually under the project's debug settings)

This allows it to work the same way whether run from the IDE or not.

share|improve this answer

Try compiling it on another computer, or reinstall codeblocks along with gcc. At least that's how it worked for me.

share|improve this answer
This is a bad solution, why would you want the user get out of his environment or install another setup? – Alexandre Vaillancourt Feb 14 at 13:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.