Where Can I Get libgcc_s_dw2-1.dll?

2019-04-08 08:58发布

问题:

The programme I have written uses SFML but fails when run because libgcc_s_dw2-1.dll is missing. I'm using tdm-gcc and can't find the file anywhere on my computer and re-install doesn't help and a simple hello world programm works fine so I'm not sure why it needs this dll.

Which mingw package can this be found in? I've had a search on the site but cant find it. Apologies if I have just missed an obvious search result but this is incredibly frustrating! Thanks in advance, ell.

P.S. I'm on 64-bit Windows 7 by the way

EDIT: Sorry I forgot to mention I had already read the answer to another question with the same problem, but as I have said, I cannot find the file anywhere on my computer, in the bin directory or otherwise. Also, passing -static-libgcc and -static-libstdc++ to the compiler and/or linker gives me unrecognized option '-static-libstdc++'. Sorry for not clarifying that I have read this already. Thank you!

回答1:

That file implements the exception handling using DWARF information (new style, versus setjump/longjump or SJLj, the old style.

So you should need it only if your code depends on exceptions of any kind.

If you feel lucky you can grab my own compilation of this file from here.



回答2:

I believe this is a tdm/gcc compiler issue, rather than a Microsoft Visual Studio setup.

The libgcc_s_dw2-1.dll should be in the compiler's bin directory. You can add this directory to your PATH environment variable for runtime linking, or you can avoid the problem by adding "-static-libgcc -static-libstdc++" to your compiler flags.

If you plan to distribute the executable, the latter probably makes the most sense. If you only plan to run it on your own machine, the changing the PATH environment variable is an attractive option (keeps down the size of the executable).

Updated:

Based on feedback from Greg Treleaven (see comments below), I'm adding links to:

[Screenshot of Code::Blocks "Project build options"]

[GNU gcc link options]

The latter discussion includes -static-libgcc and -static-libstdc++ linker options.