Reputation: 1974
I have a C++ project using Qt and I have it working as expected. However, the problem is when I copy the executable to a standard installation of a OS (e.g. Windows or a Linux) upon execution I receive the QtWidgets or some other Qt libraries missing error.
I tried referencing the Qt Documentation but I am unable to find a solution or an example of what I am after. It has something to do with Static and Dynamic Building... but could not locate a good example or tutorial.
I looked at the tutorial http://www.qtcentre.org/wiki/index.php?title=Deploying_Qt_Applications but it is not quite the most efficient solution.
Basically I want the system to include the required Qt libraries along with the final compiled file. How can I pull it off?
Upvotes: 0
Views: 934
Reputation: 4178
What you can do is making a script which copies your DLLs (or .so* files) in the executable folder. Once you make it add an extra Makefile target in your project file :
theproject.pro:
OTHER_FILES += copy.script # Assuming your copy script is called "copy.script"
deploylibs.target = deploylibs
deploylibs.command = ./copy.script # Launching the script
QMAKE_EXTRA_TARGETS += deploylibs
Now you can deploy your libraries by using the (n
)make deploylibs
command.
NB: there is a very useful tool called "Dependency Walker" to find the DLLs you need. It is only for Windows. As for Linux and its *.so*
files you can use the ldd
command :
>$: ldd theexecutable
alib.so => /path/to/library/on/your/computer.so
...
Upvotes: 1