libgcc_s_sjlj-1.dll is missing in Qt 5.1 - c++

My program won't start, complaining that libgcc_s_sjlj-1.dll is needed. However, this file doesn't exist in Qt directory. I did some search and found that -static-libgcc and -static-libstdc++ should be added. So here is my .pro file:
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
}
If this works, neither libgcc_s_sjlj-1.dll and libstdc++-6.dll is needed. However, the program still needs libstdc++-6.dll before I put it into .exe folder.
So my question is: Where can I get libgcc_s_sjlj-1.dll or is there any problem in my .pro file?

Bah, I am stupid. Your 'my program lacks libgcc_s_sjlj-1.dll, not libgcc_s_dw2-1.dll' should have rung a bell.
You compile with the wrong MinGW. There are several different exception handler for MinGW available: sjlj, dwarf, seh. Dwarf is 32bin only. When you have the libgcc_s_dw2-1.dll it means, you have a 32bit only MinGW installed.
You must compile your programs with the same MinGW, which was used to compile your Qt. The sjlj MinGW works for 32bit and 64bit so I suppose it makes sense that the qt-project provides binary packages, which were compiled with sjlj-MinGW.
There are some MinGW packages available, which allow you to choose, which exception handling mechanism you will use. Best choice is probably to use the MinGW, which is bundled in the Qt 5.1.1 installer packages.

Related

dlib and Qt: building errors

I have installed dlib to have the static library in my computer and i want to use it in a Qt project but the problem is, once the dlib library is linked to my project i can build it and display simple matrix from dlib namespace but if i try to define a deep learning network i got the following error.
/home/jimmy/Desktop/Connected_Robotics_Watson/workco/work/mainWindow.cpp:-1: error: undefined reference to `dlib::cpu::pooling::pooling()'
i am really lost on how to use with Qt.
Here is my .pro file:
QT += network
QT += widgets
TEMPLATE = app
TARGET = Connected
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui
-lopencv_imgcodecs -lopencv_videoio
QMAKE_CXXFLAGS += -std=c++11
PKGCONFIG = dlib-1
# Input
HEADERS += mainWindow.hpp
SOURCES += main.cpp mainWindow.cpp
If i use the library with normal cpp code and use a cmake to compile, evrything works well.
Does someone have an idea on this problem?

symbol(s) not found for architecture x86_64 with Qt and OpenCV

I am working on a desktop application with the Qt and OpenCV on my mac. I have installed both qmake on version 5.3.2(currently used) and 4.6.8 , OpenCV 2.4.9 , I use the GCC compiler, my Qt version is 5.3.2, Qt creator version is 3.2.2.
Previously I have a Qt project previously run on a Ubuntu, now it migrates to the mac, the only change is just on the .pro, in which the INCLUDEPATH and LIB path must change to the include and lib path of OpenCV in the mac.
Here is my configuration.
INCLUDEPATH += /usr/local/Cellar/opencv/2.4.9/include
LIBS += -L/usr/local/Cellar/opencv/2.4.9/lib \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_video \
-lopencv_objdetect \
-lopencv_ml \
-lopencv_features2d
/usr/local/Cellar/opencv/2.4.9/include and /usr/local/Cellar/opencv/2.4.9/lib are the exact location for the opencv. There should be no reason to have this error, since the opencv libraries are all there and should be linked in the right format.
right now I could not figure out how and why

Qt Creator does not recognize the my change in the pro. file

When I include something in Qt Creator, later I find out that that include does not exist, I want to correct that mistake by using a right path, or just deleting the include. But, that did not work, even if I delete the wrong include, but Qt Creator still try to find that include in the next build/run. I have already try to rebuild/clean the project but that does not work either. The only solution was to create a new project, or place the included file in that "wrong" place. I thought this question should not be a difficult one. But I fail to solve it.
for example, this is my pro. file.
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = simpleStitch
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += C:\opencv249\build\includes
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_core249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_highgui249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_features2d249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_imgproc249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_stitcher249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_calib3d249.lib
LIBS += C:\opencv249\build\x64\vc12\lib\opencv_nonfree249.lib
I have make a mistake in the LIBS += C:\opencv249\build\x64\vc12\lib\opencv_stitcher249.lib.
the right one should be stitching249.lib.
after I correct it to be stitching249.lib. the qt still try to find the C:\opencv249\build\x64\vc12\lib\opencv_stitcher249.lib. it is pretty strange. qt does not recognize my change in the pro. file even if I use the clean/ rebuild.
Run qmake? if you make changes to the .pro file then you need to qmake again or it will just be building against whatever is there from your last qmake
Please give more information, so that we can understand specific problem. Here is what you need to do before starting a new project.
To add kits, select Tools > Options > Build & Run > Kits > Add.
Each kit consists of a set of values that define one environment, such as a device, compiler, and Qt version. If you know you have installed a Qt version, but it is not listed in Tools > Options > Build & Run > Qt Versions, you must add it.
Also check that your compiler is listed in Tools > Options > Build & Run > Compilers.
And also you should modify your .pro file in order to your settings. Here is one of my project's .pro file. You can modified it yourself...
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = myTarget
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann
Then, in your code you need to include which libraries you want to use.. Such as:
#include <QMainWindow>
#include <opencv/cv.h>
#include <opencv/highgui.h>
I have never used Windows. As I know in windows symbol \ occurs problem if you not use 2 of them. Here is an example to understand clearly..
INCLUDEPATH += D:\\ProgrammingTools\\opencv\\build\\include
CONFIG( debug, debug|release ) {
LIBS += -LD:\\ProgrammingTools\\opencv\\build\\x86\\vc10\\lib\
-lopencv_core246d\
-lopencv_highgui246d\
-lopencv_imgproc246d\
-lopencv_features2d246d\
}
else {
LIBS += -LD:\\ProgrammingTools\\opencv\\build\\x86\\vc10\\lib\
-lopencv_core246\
-lopencv_highgui246\
-lopencv_imgproc246\
-lopencv_features2d246\
}

Qt program fails to run with errors referencing libwinpthread-1

I've made a C++/OpenGL application using the Qt framework, but I cannot to run *.exe file. I always get errors with libwinpthread-1.
I already read articles about that, but all dll's are in the Qt folder, so I don't understand what the problem is. Please take a look at my *.pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp \
sliceobj.cpp
unix|win32: LIBS += -lOPENGL32
unix|win32: LIBS += -L$$PWD/../../../../5.0.2/mingw47_32/lib/ -lglut32
QMAKE_LFLAGS += -static-libgcc -static-libstdc++
QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas
INCLUDEPATH += $$PWD/../../../../5.0.2/mingw47_32/include
win32 {
message("* Using settings for windows")
INCLUDEPATH += "C:\\opencv\\build\\include" \
"C:\\opencv\\build\\include\\opencv" \
"C:\\opencv\\build\\include\\opencv2"
LIBS += -L"C:\\opencv\\build\\x86\\vc11\\bin" \
-lopencv_core247\
-lopencv_highgui247\
-lopencv_imgproc247\
-lopencv_video247\
LIBS += -L"C:\\opencv\\build\\x86\\vc11\\staticlib" \
-lopencv_core247\
-lopencv_highgui247\
-lopencv_imgproc247\
-lopencv_video247\
}
Use Dependency Walker to see what exactly your code links against + Which libraries are loaded in runtime. Open your executable with DW and you will see DLL's that are linked against. They need to be present in PATH or beside your executable. Press F7 to start profiling to see which libraries are loaded in runtime. Here as snapshot:
Ok, i know that's not good, but i'm just added this files into debug directory .

OpenCV C++ - Windows IDEs

I'd like to start using OpenCV for C++ on Windows after a bunch of OpenCV4Android work. From this forum post, it seems that not all C++ IDEs have equivalent capabilities to display OpenCV images, since some do not have an integrated GUI plugin. Are there any differences between IDEs in terms of OpenCV functionality that I should be aware of?
Go with Qt Creator. It's a cross-platform IDE for C/C++ development that supports the Qt framework. When you move to Linux/Mac you can continue to use Qt Creator to develop your projects.
It's an IDE that you'll spent a day or two to master, and it will be useful for the rest of your career.
Qt Creator uses a .pro file to configure the project. The instructions on this file are used to build all the Makefiles needed to build the .exe.
This is the .pro file I use to build my Qt Creator projects on Windows/Mac/Linux:
TEMPLATE = app
SOURCES += \
main.cpp \
cvImage.cpp
HEADERS += \
cvImage.h
## OpenCV settings for Unix/Linux
unix:!mac {
message("* Using settings for Unix/Linux.")
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc
}
## OpenCV settings for Mac OS X
macx {
message("* Using settings for Mac OS X.")
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc
}
## OpenCV settings for Windows and OpenCV 2.4.2
win32 {
message("* Using settings for Windows.")
INCLUDEPATH += "C:\\opencv\\build\\include" \
"C:\\opencv\\build\\include\\opencv" \
"C:\\opencv\\build\\include\\opencv2"
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
-lopencv_core242 \
-lopencv_highgui242 \
-lopencv_imgproc242
}