Error when launching application - c++

I have rebuilt the QGIS code on VC2008 on Windows 7.
I have all the correct DLLs in the folder of the exe, and can see that it knows where the QT DLLs are.
When I launch the app, I get this error:
The procedure entry point ??4QPixmap##QAEAAV0#$$QAV0##Z could not be
located in the dynamic link library QtGui4.dll
I'm not sure where to start to get this working. I checked the QtGUI4.dll to see that it is loading, with a dummy app. It seems fine.
Any help would be great.

Posting it as an answer since my hunch turned out correct:
This error shows that your application was loading the wrong Qt DLLs. For whatever reason, it was finding and loading DLLs different from the DLLs against which it was built. In your case it turned out it was finding Qt4 built for VS2010 DLLs, while it needed Qt4 built for VS2008.
The solution is to make sure it always finds the correct DLLs - place the correct DLLs in the EXE's folder, as this is usually the first place it looks for for DLLs. On Windows, it's not a good idea to rely on %PATH% or on the current directory.

Related

Qt C++ Missing DLLs

I created a simple notepad file using Qt.
The program does run when in Qt creator.
However, when I navigate to the debug folder, the created executable file does not run without DLLs.
I've read online that this is can happen and all that is required is that the respective DLLs be copied to the location of the exe file. However... the error messages identify DLLs that my machine does not have.
I get and error message for the following DLL files.
Qt5Cored.dll, Qt5Widgetsd.dll, QtPrintSupportd.dll
I do not have the DLLs above. I do however have the dll files below. Which do not have the added 'd' before the extension.
Qt5Core.dll, Qt5Widgets.dll, QtPrintSupport.dll
Any help provided would be much appreciated.
Thank you in advance!
First i can't think of any reason you would want to copy (preparing for an installer) the dependencies for the debug build of your application, the debug is not a build that you want to deploy, use the release build for deployment.
Now, that being said, you definitely have the dll's, otherwise your debug build won't run from Qt Creator, you are just not looking in the right path for those dlls.
The path where you find the dll is something like: C:\Qt\5.12.3\msvc2017_64\bin
notice that there can be many Qt versions installed and for different targets (example android), so the right way to find the dlls is: QT_INSTALL_PATH / QT_VERSION / COMPILER_VERSION _ARCHITECTURE / bin, so the sample path i provided is Qt version 5.12.3 build with Visual Studio 2017's compiler and it is a 64 bit build. In that path you will find the right dlls: Qt5Core.dll (the release build), Qt5Cored.dll (debug) and so on for all the Qt modules.
Side note: you most likely looked into the folder where Qt Creator .exe is located, there you will find only the Qt dlls that are needed for Qt Creator to work, you are not supposed to use those dlls to deploy your application (those might be built with a different compiler than what you are using and even cause crashes for your application, because of incompatible abi)

Qt-Application Deployment doesn't work. Missing entry point and dll's

In the last months I created a project with the Qt-Creator version 4.7.0, Qt version 5.11.1 (open source version).
Now I tried to deploy it following the Qt doc and building the project with MSVC2017-64bit compiler as well as running windeployqt.exe afterwards on the generated executable.
As I tried to run the executable after the programm finished copying the neccessary dlls into the folder, a warning appeared:
The entry point ?
eventFilter#QAbstractItemView##MEAA_NPEAVQObject##PEAVQEvent###Z wasn't found in DLL "my/project/path/releasefolder/project.exe".
It seems to me like something was wrong with the Qt-Objects I use in my project, but I couldn't find anything, as it still worked flawlessly in the Qt-Creator.
A thought it might be due to the compiler having issues, so I changed it to mingw32, which I also tried to deploy the same way. But somehow in this case the warning disappeared, but many dlls were still missing even though windeployqt.exe should've already done that. And I also couldn't find them anywhere on my hard drive. I also tried a third compiler, but the issues weren't going away.
I searched online and only found people having problems with an entry point missing in a Qt dll or missing the Qt-Dlls in general, but haven't found anything related to my case.
I also tried Dependency Walker on every executable, but it found even more missing dll, which led me to believe the executables were somehow currupted so I tried it again and again, but with no success unfortunately.
Has someone any idea, why that could happen, or any suggestion for me?
Maybe I should change something in my project, even though it works fine in the IDE. I just need a way to deploy my Qt project in any way.
EDIT: Build using the Desktop Kit in Qt Creator with MSVC2017 the described warning appeared.
Build with Mingw32 (Desktop Kit) and with MSVC2017 using the UWP Kit in Qt Creator the following Dll was missing, that I haven't found anywhere on my hard drive: MSVCP140_APP.dll
EDIT2: I ended up downloading the required dll, to somehow get it to work, but it still didn't work. One build, that required that dll now started but immediately closes itself again and the other build was suddenly warning me of a missing procedure entry point.
EDIT [SOLUTION]: I let the Qt Creator create a whole new fresh project and copied all files from my old project in the new one. After that I only copied all the dll files into the folder and it worked.
Instead of relying on windeploy, manually add the dll. I am assuming you have built the project using mingw. Assuming you are using Qt 5.11.1, go to
C:\Qt\Qt5.11.1\5.11.1\\bin\ and copy all the dll files and paste in your executable folder. Also copy all directories from plugins folder (in /plugins) and paste in your folder. Now run the application, don't close the application. Now delete all the files from your executable folder. The one's not being used are deleted and the rest are left. I assume you are doing this on target computer. This might help.

QT Deployment error

I am trying to deploy a QT5.4.1 appplication on Windows 7 - x86.
As always, everything is working fine on my machine, but not in the end user's machine.
When I try to run the app, it gives me the following error:
After searching on the internet, most solutions say that I need to add a platforms folders containing some dlls (qminimal, qoffscreen, etc) to the deployment package. I tried that with no success.
The funny thing is that I copied QT installation folder to the end user machine and deleted everything except this folder (C:\Qt\Qt5.4.1\5.4\msvc2012_opengl\plugins\platforms) and it works fine.
So, somehow my app is looking for the platforms folders in QT installation folder instead of the deployment package folder.
Does anyone know how to solve it?
EDIT:
I have managed to change all QT Dlls to the release version (without "d" sufix). However, when i compile my project I still get some vc++ dlls in debug mode. I checked all project configurations in both "linker" and "c/c++" sections and they all use "release" configurations. When I run the program, It gives me a "debug assertion failed". Why I am getting the debug versions of vc++ dlls?
Here is the dependency walker screenshot
The comments of Mezzo seem very relevant. We regularly deploy commercial Qt Windows applications. You could use dependency walker to find the dependencies or just double click on the executable and look at the Windows complaint about what dll's are missing. Just copy them to the deploy location, preferably with a qmake script.
The plugin dll's are more difficult to deal with. They do not show up as dependencies. The operating system could complain about their absence (dll's located in the subdir "platforms" for instance) or your application might just not use their functionality (dll's in the subdir "imageformats" for instance) without any complaint. To protect yourself against the latter case you have to test drive your application thoroughly.
Windows does not need a qt.conf file. Just create the subdirs "platforms", "imageformats", ... in the application dir and copy the plugin dll's there. As an example I show the full content of an (mingw) application dir that even when copied to a virtual machine runs without any problem.
Qt5Btc1.dll is our own dll.
I figure out what is wrong, although I don't have the solution yet. Even without the solution, I think this answer might be helpful.
My project output is a DLL that has a GUI made in QT.
Another program calls this DLL and during DLL_PROCESS_ATTACH a QT GUI is created.
According to the documentation, QT looks for the plugins in:
in the directory containing the application executable, i.e. > QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
That´s why the QCoreApplication::applicationDirPath() is not the deployment directory where the DLL is located, but the directory where the external program *.exe is running. I think QT is looking for the qt.conf file in this *.exe location
EDIT: there is nothing to do with debug or release versions

Having trouble building Qt program

I created a Qt GUI application and I am trying to package it to share with other people. I built the package and used Dependency Walker to find all of the .dll files that I needed to include. After I put them all in the same directory as the .exe; I launched the .exe for the program and I got a message that another .dll was missing I included it. I was asked in the same way to add two more .dll files. After all the .dll's were included I launched the .exe and got this weird message.
I consulted Qt 5.0.2 documentation and I couldn't find any help. It works fine when I run it within Qt Creator.
I don't know what to do from here but any help would be great
Some things you could do to find out the problem:
Check if it behave the same way in debug and release mode. Note that the two modes need different DLLs.
Check if you are using the correct versions of the DLLs. If you installed different versions of Qt or other dependencies than there could be conflicts around DLLs that are the same but from different versions. Maybe you are in a kind of DLL Hell.
You should copy your program to another PC that doesn't have Qt installed. And watch if it works properly.

Debug version runs but release gives 0xc000007b - missing dlls?

When running my Visual Studio C++ application debug version through VS2010 by Project Only > ProjectName the generated exe runs well. However when I generate a release version and go to the folder where the exe is created I get the following error:
The application was unable to start correctly (0xc000007b). Click Ok to close the application
The files in the folder is only the exe file whereas my project uses various boost libraries.
Is it possible that its giving this message because of the missing boost dlls ? Is there a way to make the compiler paste all the necessary dlls in the exe folder.
Is there any way to launch the release version from VS2010 like we have for the debug version as in Debug >> Start new instance
I hate when that happens. It could be the fact that its missing the bloost DLL's: the easiest way to fix this is to add the folder to the Path environment variable. Sadly enough, we don't have enough information from your post to confirm that this is the problem. Common other problems include: you are linking to libraries that were built for a different architecture/are using a different runtime library, you are missing other 3rd party dlls, the .lib file you used in the linker is pointing to a different version of the code than the dll you are pointing to...the list goes on.
As for copying the dlls at runtime, you can do this using the custom build events [http://msdn.microsoft.com/en-us/library/e85wte0k%28v=vs.80%29.aspx]. Just write a batch script that copies the dlls as a "Post Build Event" and you should be good to go, but I'd suggest the Path way first.