qt 5 looking for API-MS-WINxx.dll using GDAL headers - c++

I am developing a C++ Software with OpenCV 3.1 and QT 5 under win7 64Bit System.
The uses compiler is the VS2010 32bit.
I have to use another lib, called GDAL. I built this lib, set PATH environment and set the project properties in QT. As soon as I include a single .h file of GDAL the developed program starts and the instantly ends. QT gives messages like “debugging started” “debugging ended”.
Set break points won’t be reached so the program isn’t even starting. The GDAL lib seems to be included correctly because the used GDAL variables and classes are indicated by the autocomplete function of QT.
I used dependency walker to see if some dll are not loaded. This tools tells me that the following dlls are missing. These dll don’t exist on the harddrive.
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-COM-L1-1-1.DLL
API-MS-WIN-CORE-DEBUG-L1-1-1.DLL
API-MS-WIN-CORE-DELAYLOAD-L1-1-1.DLL
API-MS-WIN-CORE-ERRORHANDLING-L1-1-1.DLL
API-MS-WIN-CORE-FILE-L1-2-1.DLL
API-MS-WIN-CORE-FILE-L2-1-1.DLL
API-MS-WIN-CORE-HEAP-L1-2-0.DLL
API-MS-WIN-CORE-HEAP-OBSOLETE-L1-1-0.DLL
API-MS-WIN-CORE-JOB-L2-1-0.DLL
API-MS-WIN-CORE-KERNEL32-LEGACY-L1-1-1.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L1-2-0.DLL
API-MS-WIN-CORE-LOCALIZATION-L1-2-1.DLL
API-MS-WIN-CORE-LOCALIZATION-OBSOLETE-L1-2-0.DLL`enter code here`
One dll called GPSVC.dll was downloaded from the web. I have read several threads that people have same issues. Some have been fixing these issues by installing redistributable packages. I have all available redistributable packages installed and VS2010 ultimate.
I am getting sick of this problem, does anyone have THE solution to fix? What programs are associated with these listed dlls.
Would downgrading of QT 5 to QT 4 solve the problem.
I haven’t found threads with these issues when QT 4 is used.
Any suggestions are welcome!
Thanks
edit:
just to make all this clear, I would like to give you an overview of my settings.
the windows Path variable looks like this:
E:\opencv31\build\install\x86\vc10\bin;
C:\Qt5\5.5\msvc2010\bin;
E:\GDAL\bin
the .pro file of the qt project:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = AirportExtractor
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
imageanalyzer.cpp \
airport.cpp \
filterslider.cpp \
framewindows.cpp \
scribblearea.cpp \
HEADERS += mainwindow.h \
imageanalyzer.h \
airport.h \
filterslider.h \
framewindows.h \
scribblearea.h \
FORMS += mainwindow.ui \
filterslider.ui \
framewindows.ui \
INCLUDEPATH += E:/GDAL/include/
INCLUDEPATH += E:/opencv31/build/install/include/
LIBS += -LE:/opencv31/build/install/x86/vc10/lib -lopencv_calib3d310d \
-LE:/GDAL/lib -lgdal_i \
I added the following paths to the project settings:
INCLUDE E:\GDAL\include;
LIB E:\GDAL\lib;

Related

build a standalone exe file form a QT+openCV project running in QT Creator

I just recently programmed a project in QT Creator framework which both uses QT libraries such as QT_Widget and also openCV libraries such as openCV_tracking .
my project includes .ui , .pro , main.cpp and some classes with .h and .cpp files.
my .pro file is :
QT += \
core gui \
concurrent widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Version7
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += \
c++11 \
cmdline
SOURCES += \
main.cpp \
mainwindow.cpp \
videoprocessor.cpp \
robottracker.cpp \
robotdetector.cpp \
obstaclesdetector.cpp \
pathcapture.cpp
HEADERS += \
mainwindow.h \
videoprocessor.h \
robottracker.h \
robotdetector.h \
obstaclesdetector.h \
pathcapture.h
FORMS += \
mainwindow.ui
# including openCV needed files
INCLUDEPATH += E:\\MyOpenCV\\install\\include
INCLUDEPATH += C:\\openCV\\opencv\\build\\include
LIBS += -LE:\\MyOpenCV\\install\\x64\\vc15\\lib \
-lopencv_tracking430
LIBS += -LC:\\openCV\\opencv\\build\\x64\\vc15\\lib \
-lopencv_world430
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
it runs in QT creator with no problem ; but now i wanna share it with my team and for that I want to build a standalone exe file from it which statically links all libraries used in project.
can someone please guide me how can I do that with QT Creator or some other options?
in the internet there were some suggestions but none worked .
I tried this a while ago but eventually gave up, although it definitely is possible.
The reason Qt hides how to do it so much is that they much prefer that people dynamically link to their libraries as it both allows users to update/change the Qt dll's as they please and (which I think is the real reason) it makes it more obvious that a developer is using their suite.
I will guide you in the direction I think should be taken, but I am not too sure how successful you will be unfortunately.
First you need to build the actual Qt library statically. I will assume you are using the MinGW shipped with Qt Creator as your compiler. According to the following tutorial https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW , you can download the following powershell script (ensure you have powershell installed): https://sourceforge.net/p/qtlmovie/code/ci/v1.2.16/tree/build/windows-build-qt-static.ps1?format=raw. As long as you have Qt installed under C:\Qt, and a subdirectory called "Static" in this folder, you should be able to simply run this script and wait for Qt to build into that folder.
Secondly, you need to link against the Qt libs in your application. Open Qt Creator, go to Tools > Options > "Build & Run". The Qt tutorial says the following:
Go to tab "Qt Versions". In the "qmake location" table, there must be an "Auto-detected" part and a "Manual" part. In the "Auto-detected" part, there should be one line named "Qt 5.5.0 MinGW 32bit C:\Qt\Qt5.5.0\5.5\mingw492_32\bin\qmake.exe". The "Manual" part is initially empty.
Click "Add", browse to C:\Qt\Qt5.5.0\bin and select "qmake.exe". The version name is automatically set to "Qt 5.5.0 (5.5.0)". You should set a more meaningful name such as "Qt 5.5.0 MinGW Static 32bit"
Then go to tab "Kits". Again, there must be an "Auto-detected" part and an initially empty "Manual" part. Click "Add". Set a meaningful name such as "Desktop Qt 5.5.0 MinGW Static 32bit". In the "Qt version" field, select your static environment, named "Qt 5.5.0 MinGW Static 32bit" if you followed the above advice.
Click "Add Kit" in the upper left corner and select your static kit, named "Desktop Qt 5.5.0 MinGW Static 32bit" if you followed the above advice.
That should be it. Unfortunately I'm unable to try it out by myself, but that should be the general procedure. A lot of the tutorials seem long-winded, but generally if you follow them step-by-step they work out in the end.
Also, do note that they didn't refer to the "static" directory in the above instructions. I believe this is incorrect, and that is what they are actually referring to, so maybe give that a try instead, although I'm not sure.
Good luck!

Importing libssh into Qt

I'm currently trying to import libssh into a Qt project I am working on. It appears that I have the library linked correctly as the project builds, but once I run the project it just crashes before anything really starts up. Which makes debugging difficult. If I comment out the line:
my_ssh_session = ssh_new();
Then everything runs as it should and no crash occurs. My .pro file looks like
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += sql
QT += script
QT += scripttools
QT += uitools
LIBS += -llibssh
INCLUDEPATH += $$quote(C:\libssh\include)
TARGET = white_wrapper
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
datafeeder.cpp \
dbfeeder.cpp \
xmlhelper.cpp \
hiddevice.cpp
HEADERS += mainwindow.h \
datasource.h \
datafeeder.h \
dbfeeder.h \
xmlhelper.h \
hiddevice.h
FORMS += mainwindow.ui
After looking online it looks like the problem could be dlls but after running a dll dependency application it looks like I have all the dlls needed so I guess I'm at a lose and would love some input thanks.
I was getting the same error message with libssh-0.7.1, Qt 5.2.1 and MinGW.
After some research it turned up that libssh
needs another two dynamic libraries which depends on: libeay32.dll and zlib1.dll. They are not included in libssh's distribution archive, therefore you have to download them yourself and copy next to libssh.dll (or somewhere on $PATH).
In my .pro file I have the following lines added (I installed libssh using their installer to Program Files (x86) directory):
# Libssh:
LIBS += -L$$PWD/'../../../../../Program Files (x86)/libssh/lib/' -lssh.dll
INCLUDEPATH += $$PWD/'../../../../../Program Files (x86)/libssh/include'
DEPENDPATH += $$PWD/'../../../../../Program Files (x86)/libssh/include'
Now my Qt application works without problems.

ACE (adaptive comminucations framework) wirh QT and MSVC2013 (VC12)

I am having trouble using ACE on Windows (have used it with great success on both OS-X and Linux(Ubuntu). It crashes in the ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m) function.
The OS is Windows 7 64bit.
I am building a 32bit application though (tried 64bit).
I followed http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html#win32 in order to build the 32bit libraries of ACE.
The ACE version is 6.4.0. The ACE_vc12.sln is build with VS2013_express.
My application (that works on OS-X using ACE) is build with QT5.7.0(32bit version) with kit configured to use MSCV2013 32bit configuration.
My project .pro file in QT looks like this (with some obfuscation):
`QT += core
QT += gui
CONFIG += debug
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
ACE = c:/ACE_wrappers
PathToIs = //Users/xxx/Dropbox/_Projects/xxx/is/yyy
LIBS = -L$$ACE/lib -lACEd -lpthread
TARGET = ZZZ_CSCI
include($$PathToIs/lib/ace.pri)
include($$PathToIs/Some_other.pri)
include($$PathToIs/Yet_another_pri.pri)
INCLUDEPATH += $$PathToIs/lib/shared
INCLUDEPATH += $$PathToIs/lib/utilities
TEMPLATE = app
SOURCES += main.cpp \
../../../../../lib/utilities/windows/UtilitiesWindows.cpp
HEADERS += \
$$PathToIs/lib/shared/GlobalDefs.h \
../../../../../lib/utilities/Utilities.h
INCLUDEPATH += C:/ACE_wrappers/include
DEPENDPATH += C:/ACE_wrappers/include`
The -lpthread causes a library not found link error.
What should I use for it in Windows (I believe that is linux osx specific library)?
LINK : fatal error LNK1104: cannot open file 'pthread.lib'
Out of desperation, I have removed -lpthread completely, which of course removes the linker error, but then when the application starts up, I get a crash in the function below:
ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m)
{
// ACE_OS_TRACE ("ACE_OS::thread_mutex_lock");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_WTHREADS)
::EnterCriticalSection (m);
return 0;
# else
return ACE_OS::mutex_lock (m);
# endif /* ACE_HAS_WTHREADS */
#else
ACE_UNUSED_ARG (m);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
The cursor of the debugger in QT points to the line ::EnterCriticalSection (m);
So my deduction is that some pthread library is required in windows for ACE to function correctly, but I have no idea where to find and more importantly, what to look for.
Any guidance would be much appreciated.
Regards
Ivor
So after a bit of trolling on the web, I saw that a company GlobeTOM uses ACE and I happen to know one of the owners. Gave him a call and they indicated that they used pthreads for Windows.
So got that from the WWWW and saw that I actually already tried it as well. Knowing that that path should work, was a big help.
This used the latest files, placed the dll in Windows/System32 and the lib and include files into the VC folder of MSVC2013. I used the 32bit libs.
Also then edited the .pro to include the libs. Actually, I right-clicked on the project in QT and selected "Add library", then selected "external library" and browsed to the .lib file. This adds the section into the .pro file. There are some specific options to select should you need to.
The lib to use is thus pthreadVC.lib.
Thanks to GlobeTOM for the pointers.
Ivor

How to reference 3rd party dlls/libraries in Qt projects

Been trying to figure this out for an hour now. What I have is a simple Qt Project open in Qt Creator. What I would like to do is use the SDL library (dll) with my Qt project.
In visual Studio, what I would normall do is add a reference to this dll using VS tool that provides for that. In Qt creator, I opened the .pro file for my project, and added a LIB entry for the STD dll
# Add more folders to ship with the application, here
folder_01.source = qml/BoxGame
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
symbian:TARGET.UID3 = 0xEED812B5
# Smart Installer package's UID
# This UID is from the protected range and therefore the package will
# fail to install if self-signed. By default qmake uses the unprotected
# range value if unprotected UID is defined for the application and
# 0x2002CCCF value if protected UID is given to the application
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF
# Allow network access on Symbian
symbian:TARGET.CAPABILITY += NetworkServices
# If your application uses the Qt Mobility libraries, uncomment the following
# lines and add the respective components to the MOBILITY variable.
# CONFIG += mobility
# MOBILITY +=
LIBS += C:\Users\vata\Desktop\DskProj\Dsk-build-desktop\debug\SDL.dll
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp \
blockboxes.cpp \
block.cpp \
boxengine.cpp \
boxgame.cpp \
point.cpp \
gamecontroller.cpp \
gamecontrollermod.cpp
# Please do not modify the following two lines. Required for deployment.
include(qmlapplicationviewer/qmlapplicationviewer.pri)
qtcAddDeployment()
HEADERS += \
blockboxes.h \
block.h \
boxengine.h \
boxgame.h \
Globals.h \
point.h \
gamecontroller.h \
gamecontrollermod.h \
controller.h
However, that does not seem to include the Library in Qt for my use. When I compile, I still get an SDL.h: No such file or directory error message. Would appreciate any help in figuring this out and probably learning for the future as I intend to use Qt more often than not for my development work.
Running build steps for project Tetris...
Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" clean
C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug clean
SDL.h is a C header file, not a library. For the compiler to find it, you need to add its directory to qmake's INCLUDEPATH. For example:
INCLUDEPATH += C:/Dir/Where/SDL/Headers/Are/Found
(Tip: you can use / instead of \ to stay clear of possible interpretations of \ as an escape character.)
Try something like:
LIBS += -LC:\\Users\\vata\\Desktop\\DskProj\\Dsk-build-desktop\\debug -lsdl

QtCreator and OpenCV

I managed to compile successfuly programs that use OpenCV with QtCreator but i have a problem with the dlls when i try to execute my application.
This is the error i get. The wierd thing is that i don't have this dll in my system.
I tried to download it and place it in the same directory with the executable but i get the same error.
here is my .pro file
LIBS += -Lc:/Users/Libraries/OpenCV2.3/build/x86/mingw/bin/
LIBS += -lopencv_calib3d230 \
-lopencv_contrib230\
-lopencv_core230 \
-lopencv_features2d230 \
-lopencv_flann230 \
-lopencv_gpu230 \
-lopencv_highgui230 \
-lopencv_imgproc230 \
-lopencv_legacy230 \
-lopencv_ml230 \
-lopencv_objdetect230 \
-lopencv_video230
INCLUDEPATH += c:/Users/Libraries/OpenCV2.3/build/include/
SOURCES += \
main.cpp
Anyone that knows why this problem occurs?
I found what was going wrong.
I compiled opencv again and changed my .pro file to link from that folder.
Linking with the opencv-superpack package that is provided for windows caused this problem.
I hope this will help others facing the same problem.
Did you try, instead of simply putting the dll in the folder to add it to the path of your system ?
On win XP it's something like:
Configuration Panel > System > Advanced > Paths
Downloading a versioned DLL probably won't work. libstdc++-6.dll should be in the bin directory of your MinGW installation (which was probably included with QtCreator, check there).
You must distribute this dll with your app (or link with -static) or at least add its directory to PATH.