[Qt-interest] Qt-Creator problem : collect2: ld returned

yogesh upreti yogesh.upreti at gmail.com
Fri Apr 9 13:05:38 CEST 2010


Hallo Andre,
Yes, I did know that Q_IMPORT_PLUGIN not to specify where the plugin is. I
read those links you sent already, and now I have found out the problem. I
was keeping qgif4.dll file in appDir/plugins/imageformats/ dir, and my
programme was not loading it. I tried with qt.conf file and there was
nothing happening still( may be I put the header wrong in that too), and in
the end I landed on Q_IMPORT_PLUGIN.

Well now I moved dll files to appDir/imageformats/ and I can see the icons
in my application.

Thanks a lot for help.  What should I do more to make a static build of my
application, so that there is no need to supply *.dll with application?


Thanks again,
Yogesh Upreti

Date: Fri, 09 Apr 2010 11:46:56 +0200
From: Andre Somers <andre at familiesomers.nl>
Subject: Re: [Qt-interest] Qt-Creator problem : collect2: ld returned
To: Qt-interest <qt-interest at trolltech.com>
Message-ID: <4BBEF790.4060903 at familiesomers.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100409/32253983/attachment.html 


More information about the Qt-interest-old mailing list