[Qt-interest] Qt-Creator problem : collect2: ld returned
Andre Somers
andre at familiesomers.nl
Fri Apr 9 11:46:56 CEST 2010
On 9-4-2010 11:28, yogesh upreti wrote:
> Hallo Andre,
> I have some icons in my widgets(two buttons, 1 tree view), which are
> .gif files.
> I have Imported these gif to my resource file and I am accessing these
> images from the resource.
> Problem comes when I try to make an executable and run that executable
> in a system which have no QT installed. when I run the executable, I
> can't see the icons there.
> I was trying to debug that, and I found out I need to specify to my
> programme where to find plugin for .gif images. So I try to import
> these plugin in my programme, and that where I encounter that error.
> do you think is there any other way to either show the gif
> icon(somehow by copying the gif file with code) or to specify gif
> plugins (*.dll) required for my programme?
>
Q_IMPORT_PLUGIN does not "specify to your program where to find a
plugin". It is needed to import a plugin into a static build of an
application, which I guess you are not doing. So don't use it.
To make qt load the plugin, you'll have to distribute it to the right
location so that Qt can find it. Read about in
http://doc.trolltech.com/4.6/deployment.html and
http://doc.trolltech.com/4.6/plugins-howto.html
One option for a distribution file layout that will work is this:
appDir/yourApp.exe
appDir/QtCore4.dll
appDir/QtGui4.dll
... (other core Qt libraries)
appDir/imageformats/qgif4.dll
appDir/imageformats/qpng4.dll
... (other format plugins to support)
Of course, there are also several ways to tell Qt where to find plugins,
if they are not in the default locations. Check the documentation on how
to use qt.conf and/or on how to set search paths for plugins from your
code using QCoreApplication::addLibraryPath and related functions.
André
More information about the Qt-interest-old
mailing list