PDA

View Full Version : Hot to define the directory for the dynamic libraries?



Dark_Tower
15th December 2006, 23:11
Hi, I've created an application that needs the dynamic libraries QtGui4.dll, QtCore4.dll, mingwm10.dll and the folder /plugins/imageformats for the images libraries. I would like to place all these libraries in a sub directory in the application main directory called "libs". Could you please tell me what I need to include in the Makefile or the project file to obtain an executable with this performance? Thanks.

durbrak
15th December 2006, 23:14
Have a look at the 'Using qt.conf' article in your documentation.

Dark_Tower
16th December 2006, 01:02
I've readed the doc "Using qt.conf" and created the qt.conf with this content:

[Paths]
Libraries = /libs/4.2
Plugins = /libs/4.2
I've copied the libraries at /libs/4.2 but the application doesn't start because it doesn't find the libraries. Are correct the contents of the qt.conf file?

wysota
16th December 2006, 02:18
I'm afraid qt.conf won't help you with that. Qt libraries are linked by the dynamic loader, so QLibraryInfo doesn't have time to initialise itself before it is even loaded into process address space. You can only manipulate plugins search paths this way, but not Qt libs themselves.


Without qt.conf, the Qt libraries will use the hard-coded paths to look for plugins, translations, and so on. These paths may not exist on the target system, or they may not be accesssible. Because of this, you need qt.conf to make the Qt libraries look elsewhere.

Dark_Tower
16th December 2006, 11:47
Thanks wysota, now I understand why QCoreApplication::addLibraryPath only is useful for the plugins path

staffordaz
28th December 2006, 22:15
You could also set the environment PATH to include your libs directory. Then the Windows loader will find them when launching your app.