Qt5 - Windows: VCRUNTIME140D_APP.dll was not found - c++

I am about to deploy a small application on Windows 10. I successfully build and run the application and created the executable file thanks to this post.
The problem I have is that all of a sudden there is a missing .dll. And to be specific the error message after clicking on the .exe to make sure the application was working to my surprise was the one below:
VCRUNTIME140D_APP.dll was not found
In my debug folder I have the .exe created and had no idea why was asking for that library.
here is my .pro file:
QT += quick quickcontrols2 concurrent network core gui
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
TARGET = SMTPEmail
TEMPLATE = app
DEFINES += SMTP_BUILD
#win32:CONFIG += dll
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
progressbardialog.cpp \
robot.cpp \
robotmanager.cpp \
settings/emailaddress.cpp \
settings/mimeattachment.cpp \
settings/mimecontentformatter.cpp \
settings/mimefile.cpp \
settings/mimehtml.cpp \
settings/mimeinlinefile.cpp \
settings/mimemessage.cpp \
settings/mimemultipart.cpp \
settings/mimepart.cpp \
settings/mimetext.cpp \
settings/quotedprintable.cpp \
settings/smtpclient.cpp \
user.cpp \
usermanager.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
progressbardialog.h \
robot.h \
robotmanager.h \
settings/SmtpMime \
settings/emailaddress.h \
settings/mimeattachment.h \
settings/mimecontentformatter.h \
settings/mimefile.h \
settings/mimehtml.h \
settings/mimeinlinefile.h \
settings/mimemessage.h \
settings/mimemultipart.h \
settings/mimepart.h \
settings/mimetext.h \
settings/quotedprintable.h \
settings/smtpclient.h \
settings/smtpexports.h \
user.h \
usermanager.h
What have I done so far
1) In order to solve this last problem I researched and came across this useful post which also explained the main difference. Although the thing to be noted is that this application will run on Desktop only.
2) I found this version to download vcruntime140_app.dll from which I downloaded the missing library. Unzipped and added to my debug folder as also possible to see from below print screen:
After that I built and run the application but surprisingly I was getting the same exact error despite missing .dll was manually added to the debug folder.
3) I did more research and came across this, this post and also this one. But all of them together didn't help me figure out how to understand what the problem was.
4) I tried to install this version too vcruntime140d.dll from the same site at point 2) above, but still the same result. Missing library VCRUNTIME140D_APP.dll was not found
Last thing I have to notice is that: I downloaded and tried vcruntime140_app.dll then vcruntime140d.dll but I am not able to find a vcruntime140d_app.dll if it exists.
I don't understand why, despite the library is there as is possible to see also here C:\Users\me\OneDrive\Desktop\build-signalsQML-Desktop_Qt_5_12_0_MSVC2017_64bit-Debug\vcruntime140_app.dll the double click on the executable still give the same error.
Thanks for pointing in the right direction for solving this problem.

Solution is to deploy QT dependencies to application folder. After trying a lot, following command solved the issue for me.
C:\Qt\5.12.10\msvc2017_64\bin>windeployqt.exe Project path\Release
This command copies all the required QT dependencies to application folder.
Got the hint from the following link:
QT forum reference

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!

Qt5 - Windows :Windows cannot find executable

I am trying to build a project using Windows 10 and Qt5.12. The small program is using the smtp protocol available here. I can confirm that on my Windows I have the OpenSSL 1.1.1c 28 May 2019. On my Ubuntu 19.04 the same exact program compiles and run as usual but not on Windows.
I git clone my repository into Windows, followed successfully this post and the program builds correctly.
The problem is that when I run it, it cannot find the executable and is asking for it as it is possible to see from the print screen below:
here is my .pro file:
QT += quick quickcontrols2 concurrent network core gui
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
TARGET = SMTPEmail
DEFINES += SMTP_BUILD
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
progressbardialog.cpp \
robot.cpp \
robotmanager.cpp \
settings/emailaddress.cpp \
settings/mimeattachment.cpp \
settings/mimecontentformatter.cpp \
settings/mimefile.cpp \
settings/mimehtml.cpp \
settings/mimeinlinefile.cpp \
settings/mimemessage.cpp \
settings/mimemultipart.cpp \
settings/mimepart.cpp \
settings/mimetext.cpp \
settings/quotedprintable.cpp \
settings/smtpclient.cpp \
user.cpp \
usermanager.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
HEADERS += \
progressbardialog.h \
robot.h \
robotmanager.h \
settings/SmtpMime \
settings/emailaddress.h \
settings/mimeattachment.h \
settings/mimecontentformatter.h \
settings/mimefile.h \
settings/mimehtml.h \
settings/mimeinlinefile.h \
settings/mimemessage.h \
settings/mimemultipart.h \
settings/mimepart.h \
settings/mimetext.h \
settings/quotedprintable.h \
settings/smtpclient.h \
settings/smtpexports.h \
user.h \
usermanager.h
On my Desktop it is created automatically the build folder and thought that the executable would have been here. Below I Am also attaching a print screen of what is inside the build folder:
Originally this project was deployed on Ubuntu and that gave me no problem. I git clone that repo into my Windows, added the missing SMTP_BUILD but I can't fine the executable that the window in the print screen is asking. What am I missing for this final step?
Thank you very much for pointing in the right direction.
As shown in the image of your .pro you are using TEMPLATE = lib whose objective is to create a library whose product is a .dll, .so, etc. that is not an .exe.
If you want to generate an executable you must use:
TEMPLATE = app
Plus:
To make it easier to include the library in your project, I have created this project whose objective is to provide a .pri that is easy to link to any project with .pro. To do this you must follow the following steps:
Download the project
Add include(/path/of/SMTPEmail.pri) to your .pro
Includes using #include <SmtpMime>

Compiling Qt Tool out of Qt source tree

I am trying to compile canbusutil found in qtserialbus/src/tools/canbusutil out of the Qt source tree. So i just copied the folder to another place and tried to compile. However, I end up with this error:
Project ERROR: Project has no top-level .qmake.conf file.
So I had a look into the canbusutil.pro file:
QT = core serialbus
SOURCES += main.cpp \
readtask.cpp \
canbusutil.cpp \
sigtermhandler.cpp
HEADERS += \
readtask.h \
canbusutil.h \
sigtermhandler.h
load(qt_tool)
Removing the last line leaves me with different errors complaining that some conversions are not allowed or inherited methods not available. Building as part of the Qt sources works just fine. How do I have to adjust the *.pro file to get this to compile out of the Qt source tree.
You need to set the template, and make it a console project:
QT = serialbus
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
SOURCES += main.cpp \
readtask.cpp \
canbusutil.cpp \
sigtermhandler.cpp
HEADERS += \
readtask.h \
canbusutil.h \
sigtermhandler.h
When I try to build qttools\src\linguist\lrelease
the tools are looking for .qmake.conf in the directory that contains the linguist directory. So qttools\src\.qmake.conf
the contents of my .qmake.conf file is:
load(qt_build_config)
CONFIG += qt_example_installs
MODULE_VERSION = 5.8.0
Disclaimer:
My experience with this is on Windows so far. Linux may have different default behavior, and I'm not yet sure which environment variable it would be related to.

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

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;

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