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\$

3 Answers 3

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

\$\endgroup\$
3
\$\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.

\$\endgroup\$
-2
\$\begingroup\$

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

\$\endgroup\$
1
  • 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, 2016 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .