Qt Release build unable to open DLL - c++

While my application runs fine and nice in Debug mode of Qt 4.8.1 using QtCreator 2.4.1, it fails to start up in Release mode. Double clicking the generated .exe returns:
"The application was unable to start correctly (0XC000007B). Click okay to close the application."
Running in QtCreator simply stalls (the application window does not appear) and it will eventually returns with error code: -1073741819
Running Dependency Walker will show that:
I have tried to search the location of msvcr90.dll and it appears in multiple directories under C:/Windows/winsxd/...
What should I do to fix this problem at this point? My machine is 64x Windows 7.

You should deploy the Qt (and some other) libraries in order to run your application by that way.
The dll files are in the bin folder of your library installation path. For example, in my machine it is:
C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\bin
Because I'm using the MSVC2010 version (instead of the MinGW version) of Qt. Dependency Walker will tell you what files do you have to copy.
Qt Creator should run your application fine. What version of Qt are you using? (4.8, MinGW or VC2010)

Related

deploy QML-using, QBS-built Qt application to windows

I have made an application in QtCreator
I use QML for the GUI, and I use QBS as the build system
I want to be able to deploy the application to windows (and maybe to Linux and MacOS, but right now, I'm only concerned with Windows)
I tried following the deployment tutorial for Qmake with a minimal example(using QBS to build the binary on windows, and with the MSVC2017 compiler, as of 2018-05-23 3:38 PM GMT-6 I've been trying to install MinGW with the Qt Maintenance tool for the last 6 hours, and it's still only at 5%, so I will try with MinGW once that finishes), but I have the following problem
using the Qt Quick Application - Swipe template, the release version with the MSVC2017 compiler, after using windeployqt.exe --release --qmldir ../src example.exe to get the dlls and other libraries
and trying to execute example.exe, I get a message saying
"Qml debugging is enabled. Only use this in a safe environment!"
in a cmd window, right before the actual application starts
and even if I try to disable that in the build step of the project, it doesn't get disabled
it still shows the cmd with the message, is there a way to completely make sure the build settings will work? am I missing a QtCreator configuration to make sure the settings I set actually do what they're intended? do I need to restart Qtcreator or Windows for them to work?
Update: still happens, even with MinGW
This is a bug that will be fixed in Creator 4.7. See https://bugreports.qt.io/browse/QTCREATORBUG-20377.

cannot compile any application in Qt5 on Windows7

I have installed Qt Creator 4.0.1 (based on Qt 5.6.1) on Windows 7 (64 bit), it finds two kits (Desktop Qt 5.6.1 MCVS2013 64bit2 and Desktop Qt 5.7.0 MCVS2013 64bit), both have two debuggers to choose (MinGW or Debugging tools for windows). So everything seems to be OK, but whenever I press Run for any simple application from examples, the Build indicator goes red, and then disappears, and the exe-file is not created, but IDE does not give any explanation to the reason why.
I'm new to Qt and really want to find out what I am doing wrong and get started with it. The error output is as follows:
Cannot find file: D:\рабочее\БГУИР\qt\first\myfirst\myfirst.pro.
12:30:54: The process "C:\Qt\5.7\msvc2013_64\bin\qmake.exe" exited with code 2.
Error while building/deploying project myfirst (kit: Desktop Qt 5.7.0 MSVC2013 64bit)
When executing step "qmake"
Maybe the Cyrillic charset causes the problem?
There has to be an output of some kind somewhere. If not under the debug tab "issues", then perhaps "Compile output".
I know that on Linux if you are running a QT example, you have to make sure you have made a copy of the code instead of running it in place. Otherwise, Qt will try to create a build folder under /opt and fail due to permission. You could also specify such a build folder when you configure the project. I am not sure whether on Windows it is going to be an issue, but it's a good place to check.
Hope this helps.

Why my Qt app request msvcp120d.dll on a computer but not mine

I did an application with Qt5.5, wich use open cv.
It works, so now I want to deploy it on several computers.
On the first PC (PC1), it works too : I copied the dll of Qt and open cv and add the paths in the environment variables. I copied a folder with my application, some dll and datas (images).
On the second PC (PC2), I did the same, but I can't open the application. I have the error "msvcp120d.dll is missing..".
I compiled my app in release mode.
On my PC and PC1 I moved msvcp120d.dll on the desk, and the app don't request it.
Do you know why the app asks a debug dll?
I soon installed the redistribuables packages visual C++ (x64 and x86) on PC2, but it doesn't install msvcp120d.dll.
Do you have an other idea?
thanks'
It seems like some of the libraries that you are using is linking against a Debug CRT library (indicated by the trailing d in "msvcp120d.dll"). Those aren't redistributable, and are only available on systems, where Visual Studio is installed.
I would recommend to use dependency walker to find out which dlls/libraries that need the debug version and then recompile them as release configuration.

Qt deployment issue (MinGW inside)

I try to deploy a Qt app on a basic Windows 7 Pro SP1 machine.
My app works fine when I run it inside Qt Creator or on any machine with Qt insllated.
I have read a lot of posts and try many different things without success.
Things tried :
Windeploy Qt
Quick and dirty method of Qt Wiki
Add mingwm10.dll
Add libEGL.dll
Check loaded dll with dependency walker
Check loaded dll with Qt Creator debugger
My app crashes when I run it with these two error messages :
This application failed to start because it could not find or load the Qt platform plugin "windows".
This application has requested the runtime to terminate it in an unsual way. Please contact...
This is my current tree (obtained with windeployqt) :
*.exe
*.dll
platforms/qwindows.dll
imageformats/*.dll
iconengines/*.dll
With dependency walker, I have some red lines even if the app runs normally but nothing interesting.
Dev machine info :
Windows 7 Pro Sp1 64 Bits
Qt Creator 3.3.0
MinGW 4.9.1 32 Bits
Qt SDK 5.4.0
I'm probably doing something wrong but what ?!
The executable seems to search something in the Qt base directory because when I rename it the deployed app doesn't want to work anymore.
Need help please ;)
Ok, I found the solution...
I added this line at the very beginning of my main function :
QApplication::addLibraryPath("./");
After that, windeployqt does the job.
I hope it will help someone in the future.

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.