Cannot run Qt C++ release build. 'The procedure entry point could not be located' - c++

I am trying to deploy my Qt application and have run into a fatal error. The program works fine in the Qt editor, I can build and run it. After building my project in release mode and using windeployqt.exe to get the correct .dll's in the folder, I am treated to this error message. I get one for 5 different Qt .dll's. I found a way to remove this error by using the .dll's from Qt tools instead of the ones found in the compiler's bin directory. But, I am left with a remaining error like this. Unlike the previous errors', there is no dll being cited, only my program's directory.
I've tried this with 2 compilers by now. That which is provided by Qt, and my own installation. Both you can tell, have failed.

I had a similar problem few years ago when I was just learning QT. What I tried which did worked is that to move the .exe generated file to the location from where you copy paste the dlls and it worked like charm. You are getting the wrong dlls copied (perhaps). Try searching for correct ones on google!!

Related

Cannot run Qt Creator GUI outside of Qt. "The application was unable to start correctly (0xc000007b)" error

I downloaded C++ code from GitHub to tag images for training an object detector using Machine Learning.
Within Qt Creator 4.2.1 Based on Qt 5.8.0 (MSVC 2015, 32bit), I was able to compile and run the code. Unfortunately, I was not able to run the .exe outside of Qt Creator.
Initially, I received an error that
"The program can't start because libgcc_s_dw2-1.dll is missing".
Thanks to
QT The program can't start because libgcc_s_dw2-1.dll is missing, that was fixed easily by adding
"QMAKE_LFLAGS += -static"
to the .pro file. Now, when I run it I get
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
I was able to reproduce the error using the simple "Hello World" default project that appears when you create a Qt Widget Application. This led me to believe something was wrong with my installation.
Based on the advice of this article: https://stackoverflow.com/questions/12099117/32-bit-qt-application-on-win-7-x64-wont-run-but-runs-fine-from-qt-creator, I used Dependency Walker to identify possible causes. I expected to see only a few items that I can follow up on. Instead, I received a list of close to 100 missing .dll files. All the files started with
"API-MS-WIN ###.DLL" or "EXT-MS ###.DLL"
where ### represent some additional text characters, for example;
"API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL"
I'm attaching a sample output.
Another suggestion was to copy over
libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll.
That did not work either.
My next move was to simply get the latest version of QT and wish for the best. I installed Qt Creator 4.8.1 Based on At 5.12.0 (MSVC 2015, 32 bit). This time, I could not even get the code to run in the IDE. I received 1000+ error messages!
Based on advice from several pages, I added
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
to the .pro file and it still would not compile.
Also, I verified that the application is being built as a 32bit application. I'm running on a 64 bit Windows 10 system.
If anyone would like to take a crack at it to see if they can create a working .exe, here is the link: github.com/clavicule/BBTag
Qt provides a tool to copy the necessary dlls to the folder of your executable.
The tools is called windeployqt.exe and comes with your Qt installation. For me it is located at C:\Qt\5.9.1\msvc2015_64\bin\windeployqt.exe. You will have to look at your installation path and probably the msvc_32 folder to find it.
Then you go to the folder with your executable in it, oben a command prompt or powershell and execute path\to\windeployqt.exe yourProgram.exe and it will automatically copy the necessary dll files to this folder. Afterwards you can run your program without issues.
The official documentation for the tool can be found here.
Alternative 1: While developing you could use QtCreator which automatically adds the paths to the dlls when running your program - make sure to include them if you deploy your program!
Alternative 2: Add the path to the necessary dlls to your PATH variable. This isn't recommended either, since everyone who gets your program would have to do the same to run it.
I figured it out! My installation of Anaconda (a Python distribution popular for data science and machine learning) is the culprit.
From: #remy-lebeau
The application was unable to start correctly (0xc000007b)
The error:
"The application was unable to start correctly (0xc000007b) ..."
is a good indicator that the 32-bit app tried to load a 64-bit DLL. At first, this did not make sense since I verified many times that I was using the 32 bit version of Qt.
It turns out that the installation of the 64 bit version of Anaconda also contained many Qt5 dlls used for the PyQt5 package. Since the path to this folder came before the path to my c:\Qt...\bin folder, it was used in the build instead of the actual 32 bit version installed with Qt. This was not obvious because I was unaware of PyQt5 so I had no idea that it came with Anaconda. A simple reordering of the path entries using the System Environment Variables interface AND a system restart fixed the problem.
Silver lining: I now know C++ and designing GUIs w/ QT and PyQt5
Thanks #albertmand and #jwernerny

Debugging Qt in visual studio, msvcp140d_app.dll is missing

I'm new to Qt, but have been working with Visual studio for C/C++ development for a few years. Now I'm trying to build a GUI for my project. I installed Qt 5.11.0 and the Qt VS Tools on both my work computer and home PC. At work I can build and run my project with the VS debugger, however on my home system I can build but can't run either with VS debugger or simply launching the app. I tried in release and it runs fine.
The error I'm getting is :
The code execution cannot proceed because VCRUNTIME140D_APP.dll was not found.
I get 4 of these, the first two want VCRUNTIME, the second two want MSVCP140D_APP.dll.
Solutions I've tried so far :
Uninstalled Win SDK and reinstalled
Uninstalled VS2017 and SDK and reinstalled
Searched System32, SysWOW64 and VS install directories - found msvcp140d.dll and vcruntime140d.dll, but no _app.dlls
Does anyone know what these are included with and where to get them? I can't figure out why I have them on my work computer but not at home. I have the same VS updates, same Qt version, and SDK on both systems.
Using :
Visual Studio 2017 v15.7.1
Qt 5.11.0 - msvc2017_64
I suppose I can just copy the .dll's from my work pc and drop them in the appropriate locations on the other, but I'd like to know what they should have been installed with so I can have the same setup on both systems.
Edit:
I also tried changing the platform toolset to VS2015 with Qt versions msvc2015_64 and winrt_x64_msvc2015
I found this post concerning the same missing _app.dll files. There wasn't any answer there, which is why I tried reinstalling the SDK in the hope the missing files were included there.
Edit 2:
I just scanned my entire system at work and it turns out that I don't have the missing .dll there either. That tells me that there is a difference in the project properties or configuration between the two. I use git for source control, and I am currently the only contributor to this project. When I try to build and run just the example from the getting started guide I have the same problem at home with missing _app.dll files, however it works fine at work. I'm totally confused now, and any hints are greatly appreciated.
Solution:
After trying for a couple of hours making new solutions etc. I decided to delete the entire build folder and put fresh copies of all the dependencies into it. My project now runs fine in debugging mode.
I'm fairly certain that when I originally copied the Qt .dll files into it I must have grabbed them from one of the winrt folders rather than the msvc2017_64 folder. To test I replaced the working .dll files with those from the winrt_x64_msvc2017 folder and sure enough the same errors again. So, this was a dumb mistake on my part, but hopefully it'll save someone else a lot of hair-pulling in the future.

Stand-alone app with wxWidgets

I've got a problem with my app, when it comes to executing it in compiled .exe form. I am new in this and I don't know where the problem is. I already tried to search this problem on Google & this site but nothing what I found helped me.
I am using Code::Blocks IDE with MinGW and wxWidgets 2.8.X installed.
Everything works fine inside IDE, but when I try to run it as exe - already compiled - I get an error like this:
The program can not start because the computer is missing wxmsw28u_gcc_custom.dll.
Try to solve this problem by reinstalling the program.
When I copy this .dll file right next to my .exe then it will execute without any errors.
Any clues how to fix it ? I guess it's easy to fix but I really don't know how ...
It needs the DLL file to execute. You can either ship that with your app, or compile wxWidgets as a static library, so that it will be shipped in your .exe file (thus making it bigger).

QT is failing to build ui_mainwindow.h, error 135 (-1073741515)

My QT5.1.1 project used to build with qt creator but when I came into work today it no longer worked. To my knowledge, nothing has changed since the last time I was on. A co-worker needed to use my workstation earlier this week and says that he did not change anything.
The error shows up as:
[ui_mainwindow.h] Error -1073741515
I did a Google search and tried a few things.
This page said to try a clean build and run qMake then rebuild. This did not work even after trying multiple times.
This page led to the suggestion of adding QT += widgets to the .pro file (although I did not believe this would work I tried anyways)
I also tried closing the project and re-opening it. I deleted the build directory and that didn't work either.
EDIT:
I added error code 135 because according to this answer on stack overflow the two are related. I have not encountered or seen this error code come up. I have downloaded the dependency walker but I am not sure how to use it.
After a clean start up I get the following pop up when opening a project.
Image of error pop up
It turns out that a coworker accidentally moved a bunch of DLLs out of my MinGW bin directory. I had to move them back.

Error while trying to run a release build of a Qt application on Windows

I'm trying to build the Windows version of my app. The program compiles and runs fine on Qt Creator but when I try to run it standalone it throws the following error:
The procedure entry point _Z17qt_message_output9QtMsgTypePKc could not be located in the dynamic link library QtCore4.dll
I have all the necessary dlls in my application folder and they are the same ones that came with the binaries I've downloaded from the Qt's website. This error is driving me crazy for I can't seem to find any reason for it. The application runs fine on Linux and MAC OS X.
Ok I found the problem. I was copying the wrosng dll (not sure why Qt ships with 2 different versions).
The right ones are in:C:\Qt\2010.05\qt\bin and NOT in C:\Qt\2010.05\bin
I hope this helps anyone who might stumble upon this issue.