Author Topic: Help, my EXE won't work cuz' of missing libstdc++-6.dll  (Read 22252 times)

CodeWolf

  • Guest
Help, my EXE won't work cuz' of missing libstdc++-6.dll
« 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!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Help, my EXE won't work cuz' of missing libstdc++-6.dll
« Reply #1 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.
« Last Edit: October 29, 2020, 10:27:27 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Help, my EXE won't work cuz' of missing libstdc++-6.dll
« Reply #2 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Niya

  • Single posting newcomer
  • *
  • Posts: 1
Re: Help, my EXE won't work cuz' of missing libstdc++-6.dll
« Reply #3 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