Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

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.