Qt 5.1中缺少libgcc_s_sjlj-1.dll

时间:2013-09-02 03:10:20

标签: c++ dll qt5

我的程序无法启动,抱怨需要libgcc_s_sjlj-1.dll。但是,Qt目录中不存在此文件。我做了一些搜索,发现应该添加-static-libgcc和-static-libstdc ++。所以这是我的.pro文件:

QT       += core gui xml

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = mouseEventProcess
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp \
    fileOp.cpp \
    xmlpraser.cpp \
    pixmapOp.cpp \
    mathOp.cpp

HEADERS  += mainwindow.h \
    fileOp.h \
    xmlpraser.h \
    pixmapOp.h \
    mathOp.h

FORMS    += mainwindow.ui
#COMPILE LIBGCC_S_SJLJ-1.DLL AND LIBSTDC++-6.DLL INTO THE EXE FILE
win32{
QMAKE_LFLAGS += -static-libgcc
QMAKE_LFLAGS += -static-libstdc++
#BOOST LIBRARIES. CHANGE TO YOUR OWN.
INCLUDEPATH += D:/boost_1_51_0
#OPENCV LIBRARIES. CHANGE TO YOUR OWN.
INCLUDEPATH += D:/opencv2.4.4/include
INCLUDEPATH += D:/opencv2.4.4/release/install/include
LIBS += -LD:/opencv2.4.4/release/install/lib \
    -lopencv_core244 \
    -lopencv_highgui244 \
    -lopencv_imgproc244
    #-lopencv_features2d244 \
    #-lopencv_calib3d244
}
unix{
#BOOST LIBRARIES. CHANGE TO YOUR OWN.
INCLUDEPATH += /home/panda/boost_1_51_0
#OPENCV LIBRARIES.IF YOU COMPILED AND INSALLED
#OPENCV FROM CMAKE & MINGW, JUST LEAVE IT BE,
#UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING.
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2
LIBS += -lopencv_core -lopencv_imgproc -lopencv_highgui
LIBS += -lopencv_ml -lopencv_video -lopencv_features2d
LIBS += -lopencv_calib3d -lopencv_objdetect -lopencv_contrib
LIBS += -lopencv_legacy -lopencv_flann
}

如果这样做,则不需要libgcc_s_sjlj-1.dll和libstdc ++ - 6.dll。但是,程序仍然需要libstdc ++ - 6.dll才能将它放入.exe文件夹。

所以我的问题是:我在哪里可以获得libgcc_s_sjlj-1.dll或者.pro文件中有任何问题?

1 个答案:

答案 0 :(得分:0)

巴哈,我很蠢。你的'我的程序缺少libgcc_s_sjlj-1.dll,而不是libgcc_s_dw2-1.dll'应该响铃。

使用错误的MinGW进行编译。 MinGW有几种不同的异常处理程序:sjlj,dwarf,seh。矮人只有32bin。如果你有libgcc_s_dw2-1.dll就意味着,你只安装了一个32位的MinGW。

您必须使用相同的MinGW编译您的程序,MinGW用于编译您的Qt。 sjlj MinGW适用于32位 64位,所以我认为qt-project提供二进制包是有意义的,这些包是用sjlj-MinGW编译的。

有一些MinGW软件包可供您选择,您将使用哪种异常处理机制。最好的选择可能是使用MingW,它与Qt 5.1.1安装程序包捆绑在一起。