Can't start application outside qt

I can't even run HelloWorld.exe outside of QT. I coded it through QT creator 5.4.2. From build and run, QTcreator works fine. But when I try to run the generated 3rd party QT executable, I mean right on the desktop, it keeps giving me an error like missing library.

From a pure search, I think I need to do a static build. Please help me with this. Please describe the step from 0 to N cleanly so that I or others don't run into any problem.

I am using Windows and I have MSVC2010. Help with step 0 steps before executing helloworld.exe outside of qtcreator side.

thank

+3


source to share


2 answers


QtCreator maintains an internal environment path for qt libraries. To run your "HelloWorld.exe" you can simply copy the missing DLLs from qt / bin to the same executable folder. The best solution would be to add qt / bin to the system path from environment variables.

If you plan to distribute your application, the best solution is to link the qt libraries statically, not dynamically. You can read more about its capabilities:



How do I make Qt and Qtcreator link libraries statically and not dynamic?

0


source


You can deploy a Qt application, dynamically linked or statically linked. When the Qt application is launched from Qt Creator, it finds the libraries needed here C: \ Qt \ Tools \ QtCreator \ bin, but you need many more libraries.

A quick way to deploy is to run the Qt application (.exe) from your build in the C: \ Qt \ Tools \ QtCreator \ bin directory and create a symbolic link for it. This works for initial testing, but is not a way to deploy Qt applications as it requires installing Qt and the environment on the deployment machine.



Your best bet is to use the windeployqt.exe file located in the C: \ Qt \ 5.4 \ msvc2010_opengl \ bin directory, it is documented and run from the Qt command line

C: \ Qt \ 5.4 \ msvc2010_opengl \ bin> windeplyqt --help

It is documented in http : //doc.qt.io/qt-5/windows-deployment.html just over half down.

If you are deploying your application to many machines you will want to create an installer which is described here http://doc.qt.io/qtinstallerframework/index.html

+1


source







All Articles