Results 1 to 4 of 4

Thread: Static linking problem with gif plugin, qt 4.6.2, vs 2008

  1. #1
    Join Date
    Mar 2010
    Posts
    10
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Static linking problem with gif plugin, qt 4.6.2, vs 2008

    Hi

    Trying out a static build of Qt and am having problems getting the qt gif support to link in even when using Q_IMPORT_PLUGIN(qgif)

    E.g if I build Qt (4.62, using VS 2008 on a vista box) using
    configure -static -commercial -debug -qt-zlib -qt-libpng -qt-libtiff -qt-libjpeg -qt-gif -webkit -script -scripttools -no-phonon -no-phonon-backend -no-dbus -qt-sql-sqlite

    ...then I noticed that the Qt demo app 'browser' works fine but it does not display gif images.

    Now I understand that with a statically linked Qt library you have to manually get the plugins linked in so I modified browsermainwindow.cpp to include:

    #include <QApplication>
    #include <QtPlugin>
    Q_IMPORT_PLUGIN(qgif)


    and I altered the .pro file to include
    QTPLUGIN += qgif


    ... and then did qmake and a rebuild but now I get a linker error with


    1>Linking...
    1>LINK : debug\browser.exe not found or not built by the last incremental link; performing full link
    1>LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
    1> Creating library debug\browser.lib and object debug\browser.exp
    1>browsermainwindow.obj : error LNK2019: unresolved external symbol "class QObject * __cdecl qt_plugin_instance_qgif(void)" (?qt_plugin_instance_qgif@@YAPAVQObject@@XZ) referenced in function "public: __thiscall StaticqgifPluginInstance::StaticqgifPluginInstance (void)" (??0StaticqgifPluginInstance@@QAE@XZ)
    1>debug\browser.exe : fatal error LNK1120: 1 unresolved externals
    1>Build log was saved at "file://c:\Qt\qt-everywhere-commercial-src-4.6.2\demos\browser\tmp\obj\debug_static\BuildLog. htm"
    1>browser - 2 error(s), 1 warning(s)

    What am I doing wrong?

    Also, where in the Qt code does it control which plugins are automatically available in a statically linked app without having to do anything special? E.g. I noticed that the JPEG image plugin is automatically available within the statically linked browser demo without it having to use Q_IMPORT_PLUGIN. There must be some place within the Qt source where this is controlled.

    Thanks for any suggestions.

  2. #2
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Static linking problem with gif plugin, qt 4.6.2, vs 2008

    Same as me!
    Hard to build static on QT, take long time, and many problems.

  3. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Static linking problem with gif plugin, qt 4.6.2, vs 2008

    I've at least verified that it works for me. I used this pro file:

    Qt Code:
    1. SOURCES += main.cpp
    2. QTPLUGIN += qgif
    To copy to clipboard, switch view to plain text mode 

    And this source file:

    Qt Code:
    1. #include <QtGui>
    2. Q_IMPORT_PLUGIN(qgif)
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. QLabel label;
    9. label.setPixmap(QPixmap("/usr/lib/ooo3/basis3.1/share/gallery/bigapple.gif"));
    10. label.show();
    11.  
    12. qDebug() << QImageReader::supportedImageFormats();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    It works fine for me. Shows gifs (static build) and dumps gif as a supported format.

    Are you sure you have the static gif plugins built at all?
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

  4. #4
    Join Date
    Jul 2008
    Location
    Munich
    Posts
    73
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Static linking problem with gif plugin, qt 4.6.2, vs 2008

    Quote Originally Posted by Bitto View Post
    I've at least verified that it works for me. I used this pro file:

    Qt Code:
    1. SOURCES += main.cpp
    2. QTPLUGIN += qgif
    To copy to clipboard, switch view to plain text mode 

    And this source file:

    Qt Code:
    1. #include <QtGui>
    2. Q_IMPORT_PLUGIN(qgif)
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. QLabel label;
    9. label.setPixmap(QPixmap("/usr/lib/ooo3/basis3.1/share/gallery/bigapple.gif"));
    10. label.show();
    11.  
    12. qDebug() << QImageReader::supportedImageFormats();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    It works fine for me. Shows gifs (static build) and dumps gif as a supported format.

    Are you sure you have the static gif plugins built at all?
    I have the similar problem. As long as I add the line "Q_IMPORT_PLUGIN(qgif)", there will be link error.

    How did you set the first part in vs2008? And why does it need a static lib? Could you explain a little bit?

Similar Threads

  1. Replies: 4
    Last Post: 22nd May 2011, 14:36
  2. Static linking problem in Linux
    By daou in forum Qt Programming
    Replies: 1
    Last Post: 25th October 2009, 10:10
  3. Problem configuring qt for static linking.
    By Netich in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2009, 00:55
  4. problem on static linking in Linux.
    By anupamgee in forum Installation and Deployment
    Replies: 1
    Last Post: 29th May 2009, 14:45
  5. Problem when linking with own static libraries
    By herveT in forum Qt Programming
    Replies: 4
    Last Post: 6th May 2009, 09:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.