1
\$\begingroup\$

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?

\$\endgroup\$
8
\$\begingroup\$

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/)

|improve this answer|||||
\$\endgroup\$
4
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$
-2
\$\begingroup\$

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

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ This is a bad solution, why would you want the user get out of his environment or install another setup? \$\endgroup\$ – Vaillancourt Feb 14 '16 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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