Author Topic: program can't start because libgcc_s_dw2-1.dll is missing from your computer  (Read 80107 times)

Offline yuk.f

  • Single posting newcomer
  • *
  • Posts: 5
I came across a problem that when I double click on the .exe file to run a demo, it promotes a system error says "The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem" I have reinstalled the code block(10.05), but the problem still stands. Anybody know something about it?
ps: my env[ Win7 enterprise edition, 64bit ]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
If it works from inside C::B, but not from outside (explorer or commandline), it means, that the dll can not be found by the system, because it's neither in the search path, nor in the same folder as the exe.

Offline yuk.f

  • Single posting newcomer
  • *
  • Posts: 5
If it works from inside C::B, but not from outside (explorer or commandline), it means, that the dll can not be found by the system, because it's neither in the search path, nor in the same folder as the exe.

 yes as you said, it works inside the C::B. Even a simple demo "HELLO WORLD" can't exec outside the C::B. Do you have any idea how to fix it? Thanks!

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
If it works from inside C::B, but not from outside (explorer or commandline), it means, that the dll can not be found by the system, because it's neither in the search path, nor in the same folder as the exe.

 yes as you said, it works inside the C::B. Even a simple demo "HELLO WORLD" can't exec outside the C::B. Do you have any idea how to fix it? Thanks!

Offline Saerdus

  • Single posting newcomer
  • *
  • Posts: 2
I had the EXACT same problem when i downloaded some demo projects to experiment with.

If you have the same problem I did there's an easy fix.

Simply open the project with Code::Blocks and build/run the project within Code:Blocks; assuming the code runs smoothly with no errors the .exe should work now.

If not, I'm afraid i don't know what else to suggest as I'm still learning C++ as well.  :)

Lost somewhere in the nested else if statements.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
The reason is
[...] because it's neither in the search path, nor in the same folder as the exe.
Easiest fix is to simply copy libgcc_s_dw2-1.dll (it should be located somewhere similar to C:\MinGW\bin or C:\Program Files\CodeBlocks\MinGW\bin) into the same folder as the .exe.

Alternatively, add the following two switches to your linker options:
-static-libgcc
-static-libstdc++

Offline m.m.m

  • Single posting newcomer
  • *
  • Posts: 4
The reason is
[...] because it's neither in the search path, nor in the same folder as the exe.
Easiest fix is to simply copy libgcc_s_dw2-1.dll (it should be located somewhere similar to C:\MinGW\bin or C:\Program Files\CodeBlocks\MinGW\bin) into the same folder as the .exe.

Alternatively, add the following two switches to your linker options:
-static-libgcc
-static-libstdc++

Hi, Sorry to update the old thread, I'm a newbie, how can I add the switches to my linker options?

thanks a lot.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7670
    • My Best Post
Hi, Sorry to update the old thread, I'm a newbie, how can I add the switches to my linker options?

thanks a lot.

Project -> Build Options
Select correct target or project in left hand pane
Tab: Linker Settings
Box: Other linker settings
Enter linker options one per line.

Tim S.
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 m.m.m

  • Single posting newcomer
  • *
  • Posts: 4
Hi, Sorry to update the old thread, I'm a newbie, how can I add the switches to my linker options?

thanks a lot.

Project -> Build Options
Select correct target or project in left hand pane
Tab: Linker Settings
Box: Other linker settings
Enter linker options one per line.

Tim S.
Thanks for the solution, I first had two errors, one for libstdc++6.dll and one for libgcc_s_dw2-1.dll, now the error for libstdc++6.dll has solved but the error for libgcc_s_dw2-1.dll still remains.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7670
    • My Best Post
Hi, Sorry to update the old thread, I'm a newbie, how can I add the switches to my linker options?

thanks a lot.

Project -> Build Options
Select correct target or project in left hand pane
Tab: Linker Settings
Box: Other linker settings
Enter linker options one per line.

Tim S.
Thanks for the solution, I first had two errors, one for libstdc++6.dll and one for libgcc_s_dw2-1.dll, now the error for libstdc++6.dll has solved but the error for libgcc_s_dw2-1.dll still remains.

You need to add the right linker option for your compiler; I suggest reading about your compiler to find out the option you need to add; note, I know little to nothing about your compiler it might NOT have any option to fix your problem.

Edit: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.
« Last Edit: November 29, 2016, 03:42:03 am 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 m.m.m

  • Single posting newcomer
  • *
  • Posts: 4
You need to add the right linker option for your compiler; I suggest reading about your compiler to find out the option you need to add; note, I know little to nothing about your compiler it might NOT have any option to fix your problem.

Edit: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.

My compiler is MinGW, running on code::blocks 16.01, how can I find the option I need to add?
Thanks a lot

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7670
    • My Best Post
You need to add the right linker option for your compiler; I suggest reading about your compiler to find out the option you need to add; note, I know little to nothing about your compiler it might NOT have any option to fix your problem.

Edit: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.

My compiler is MinGW, running on code::blocks 16.01, how can I find the option I need to add?
Thanks a lot

Step 1: Is figuring out the group that built your compiler!
Is it an TDM's built MinGW GCC?
Is it an TDM's built MinGW64 GCC?
Is it an SJLJ or DW2 built compiler? SJLJ=Set Jump Long Jump DW2 = Drawf2
Yours is likely DW2; but, it is NOT certain.
Step 2: Is getting the Compiler version info. Like 4.9.1 or ??

Tim S.
« Last Edit: November 29, 2016, 03:24:56 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 stahta01

  • Lives here!
  • ****
  • Posts: 7670
    • My Best Post
FYI: I am done helping you till you post a build log and/or more info like I have requested.
I hated playing 20 questions as a kid; I consider it a waste of my time and this forum band width now.

Tim S.
« Last Edit: November 29, 2016, 03:43:42 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 m.m.m

  • Single posting newcomer
  • *
  • Posts: 4
You need to add the right linker option for your compiler; I suggest reading about your compiler to find out the option you need to add; note, I know little to nothing about your compiler it might NOT have any option to fix your problem.

Edit: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.

My compiler is MinGW, running on code::blocks 16.01, how can I find the option I need to add?
Thanks a lot

Step 1: Is figuring out the group that built your compiler!
Is it an TDM's built MinGW GCC?
Is it an TDM's built MinGW64 GCC?
Is it an SJLJ or DW2 built compiler? SJLJ=Set Jump Long Jump DW2 = Drawf2
Yours is likely DW2; but, it is NOT certain.
Step 2: Is getting the Compiler version info. Like 4.9.1 or ??

Tim S.
Sorry for that, I just fixed it by adding C:\mingw\bin to my search directories.
thanks a lot.