3

I am unable to run the even the HelloWorld.exe outside QT. I coded it through QT creator 5.4.2. From QTcreator build and run works fine. But when I am trying to run the generated executable out side QT, i mean directly on desktop, it keeps on giving me error like, missing library.

From net search I cam to know I need to do some static build. Please help me in this. Please describe step 0 to N cleanly so that I or other will not face any problem.

I am using Windows and I have MSVC2010. Help in from ground 0 step to till execution of helloworld.exe out side qtcreator.

Thanks

Lalat
  • 35
  • 1
  • 7
  • that lso dint help me...It wil be nice if u can provide from step 0 to till completion...thanks :) – Lalat Jun 27 '15 at 04:31
  • Statically compile Qt library itself, then modify Qt Creator settings to use new compiled library, then modify project file to enable static compiling and switch to compiled Qt instance. [This guide](http://stackoverflow.com/a/14932316/344347) looks good enough. – Pavel Strakhov Jun 28 '15 at 13:31

2 Answers2

1

It is possible to deploy a Qt application that's dynamically linked or statically linked. When the Qt application is run from Qt Creator it finds the need libraries here C:\Qt\Tools\QtCreator\bin, but there are many more libraries then you need.

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

A better way is to use the windeployqt.exe located in the directory C:\Qt\5.4\msvc2010_opengl\bin it has documentation and is run from the Qt command line

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

It's documented at http://doc.qt.io/qt-5/windows-deployment.html just over halfway down.

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

0

QtCreator keeps an internal environment path for qt libraries. To run your "HelloWorld.exe" you can just copy missing dlls from qt/bin to the same folder with the executable. A better solution would be adding qt/bin to system path from environment variables.

If you are planning on distributing your application, the best solution is to link qt libraries statically instead of dynamically. You can learn more about his option from:

How to make Qt and Qtcreator link the libraries statically instead of dynamic?

Community
  • 1
  • 1
yolgun
  • 196
  • 3
  • 14