QT该程序无法启动,因为缺少libgcc_s_dw2-1.dll [英] QT The program can't start because libgcc_s_dw2-1.dll is missing

查看:582
本文介绍了QT该程序无法启动,因为缺少libgcc_s_dw2-1.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这已经被问过了,但是我似乎找不到答案。

I know this has been asked before but I can't seem to find an answer.

我只是有一个小小的世界控制台程序,基本上是用C ++编写的与qt创作者。当我尝试运行可执行文件时,我得到程序无法启动,因为您的计算机缺少libgcc_s_dw2-1.dll。请尝试重新安装以解决此问题。

I just have a little hello world console program basically I wrote in c++ with qt creator. When I try to run the executable I get "The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling to fix this problem."

我不明白为什么这个dll对于像这样的小程序来说甚至是必需的。我尝试按照其他地方的建议添加这些标志:

I don't understand why this dll is even necessary for a little program like this. I tried adding these flags as suggested elsewhere:

QMAKE_CXXFLAGS + = -static -static-libgcc -static-libstdc ++

QMAKE_CXXFLAGS += -static -static-libgcc -static-libstdc++

它仍然会发生。其他人建议将dll所在的目录添加到我的路径中,但是我想将此程序实际提供给其他人,而无需他们使用dll。

and it still happens. Other people have suggested adding the directory whee the dll is located to my path but I'd like to actually give this program to someone else without them needing the dll.

推荐答案

我知道这是一个老问题,您可能找到了一个适合您的解决方案,但是在花了一天时间尝试用Qt 5.9构建静态链接(独立)应用程序后,我偶然发现了这个问题.1 / MinGW32-5.3.0-32bit。

I know this is an old question, and you probably found a solution that worked for you, but I stumbled upon this after a day spent trying to build a statically linked (standalone) application with Qt 5.9.1/MinGW32-5.3.0-32bit.

在构建了静态版本的Qt之后,MinGW / GCC最终引入的正是这些动态链接的库,

After building a static version of Qt, it was finally these dynamically linked libraries that MinGW / GCC pulled in that was still holding me back:

libgcc_s_dw2-1.dll
libwinpthread-1.dll
libstdc++-6.dll
libwinpthread-1.dll

尝试了无数组合后:

QMAKE_CXXFLAGS += [-static-libgcc | -static-libstdc++ | -static -lstdc++ -lpthread] 

以及在与此类似的线程中找到的其他编译器参数,最后是什么为我工作的是:

and other compiler parameters found in threads similar to this one, what finally worked for me was:

QMAKE_LFLAGS += -static

QMAKE_LFLAGS 而不是 QMAKE_CXXFLAGS ,现在是我的程序仅依赖于一堆Windows DLL。 :)

That is, QMAKE_LFLAGS instead of QMAKE_CXXFLAGS and now my program only relies on a bunch of Windows DLL's. :)

这篇关于QT该程序无法启动,因为缺少libgcc_s_dw2-1.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆