Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: CodeWolf on October 29, 2020, 07:57:50 pm

Title: Help, my EXE won't work cuz' of missing libstdc++-6.dll
Post by: CodeWolf on October 29, 2020, 07:57:50 pm

Hello fellow programmers,

I may have to introduce myself as a complete beginner in C++ programming or programming in general.
Nevertheless I still got a few little programs in Codeblocks, which work perfectly in the debugger/in the Codeblocks application.

However, if I want to run them as .exe files, an error message pops up, saying "Can't run code because libstdc++-6.dll was not found."

How do I solve this problem? Is there any library I have to set up?
I wanted to take this .exe program and send it to my friends (who don't have codeblocks) to make them check it out.

Please help me get that darn exe file working.

Thank you for your help!
Title: Re: Help, my EXE won't work cuz' of missing libstdc++-6.dll
Post by: stahta01 on October 29, 2020, 09:47:34 pm
The easiest way it to copy the needed DLLs from the compiler installation likely from inside the bin folder.

The harder way is to make an static build; but, this is not always possible when using some compiler toolchains.

Tim S.
Title: Re: Help, my EXE won't work cuz' of missing libstdc++-6.dll
Post by: MortenMacFly on October 30, 2020, 07:04:54 am
However, if I want to run them as .exe files, an error message pops up, saying "Can't run code because libstdc++-6.dll was not found."
You'll have to add these to the linker options:
-static-libstdc++
-static-libgcc
-static

...for static linking and this is done. I put this to the global compiler options because it annoys me a lot.

But be careful! Read the compiler's license what side-effects this may cause for your application.
Title: Re: Help, my EXE won't work cuz' of missing libstdc++-6.dll
Post by: Niya on October 10, 2023, 05:55:27 am
Go to "Project" menu, select "Build options...".

In the left panel, select "Release". Under the tab "Complier settings", select tab "Other complier options".

Add these below:

-static-libstdc++
-static-libgcc