从哪里可以获得 libgcc_s_dw2-1.dll?
我编写的程序使用 SFML,但运行时失败,因为缺少 libgcc_s_dw2-1.dll
。我正在使用 tdm-gcc,在计算机上的任何位置都找不到该文件,重新安装也无济于事,一个简单的 hello world 程序工作正常,所以我不确定为什么它需要这个 dll。
可以在哪个 mingw 包中找到它?我在该网站上进行了搜索,但找不到。如果我刚刚错过了一个明显的搜索结果,我深表歉意,但这真是令人沮丧!预先感谢,嗯。
PS 顺便说一句,我使用的是 64 位 Windows 7
编辑:抱歉,我忘了提及我已经阅读了 另一个问题也有同样的问题,但正如我所说,我在计算机上的任何位置都找不到该文件bin
目录或其他目录。此外,将 -static-libgcc
和 -static-libstdc++
传递给编译器和/或链接器会给我无法识别的选项“-static-libstdc++”
。抱歉没有澄清我已经读过这篇文章。谢谢你!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该文件使用 DWARF 信息(新样式,而不是 setjump/longjump 或 SJLj,旧样式)实现异常处理。
因此,只有当您的代码依赖于任何类型的异常时,您才需要它。
如果您觉得幸运,您可以获取我自己的编译此文件的内容来自此处。
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.
我相信这是 tdm/gcc 编译器问题,而不是 Microsoft Visual Studio 设置问题。
libgcc_s_dw2-1.dll
应位于编译器的 bin 目录中。您可以将此目录添加到 PATH 环境变量中以进行运行时链接,或者可以通过将“-static-libgcc -static-libstdc++”添加到编译器标志来避免该问题。如果您计划分发可执行文件,则后者可能最有意义。如果您只打算在自己的计算机上运行它,则更改 PATH 环境变量是一个有吸引力的选择(可以减小可执行文件的大小)。
更新:
根据 Greg Treleaven 的反馈(请参阅下面的评论),我添加了以下链接:
[Code::Blocks“项目构建选项”的屏幕截图]
[GNU gcc 链接选项]
后面的讨论包括
-static-libgcc
和-static-libstdc++
链接器选项。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.