Results 1 to 3 of 3

Thread: Problems loading static plugins

  1. #1
    Join Date
    May 2007
    Location
    Brazil
    Posts
    9
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Problems loading static plugins

    Hello there!

    Since yesterday, i've trying to load a static plugin in my application, but i didn't get good results.

    i followed the steps mentioneds at trolltech's site.

    1. Add CONFIG += static to your plugin's .pro file.
    Qt Code:
    1. ...
    2. CONFIG += static
    3. ...
    To copy to clipboard, switch view to plain text mode 

    2. Use the Q_IMPORT_PLUGIN() macro in your application.

    Qt Code:
    1. ...
    2. Q_IMPORT_PLUGIN(libxatp)
    3. ...
    To copy to clipboard, switch view to plain text mode 

    and finally

    3. Link your application with your plugin library using LIBS in the .pro file.

    Qt Code:
    1. ...
    2. LIBS += libxatp.a
    3. ...
    To copy to clipboard, switch view to plain text mode 

    i tried only put libxatp, but the compiler don't find the file.

    g++: libxatp: File or directory not found

    how you can see, i followed the steps, but when i compile my project, i get the following error message:

    main.o: In function `__static_initialization_and_destruction_0(int, int)':
    ==== > main.cpp.text+0x1b): undefined reference to `qt_plugin_instance_libxatp()'
    collect2: ld returned 1 exit status
    make[1]: ** [../bin/xp] Erro 1
    make: ** [sub-src-make_default] Erro 2
    *** Saiu com estado: 2 ***

    I don't know what to do to solve this problem pointed above.

    Thank in advance

    Rodrigo Amorim

    ps.: sorry about my poor english!
    Last edited by Rodrigo; 10th July 2007 at 13:45.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problems loading static plugins

    Try with following:

    Plugin (plugin.cpp):
    Qt Code:
    1. Q_EXPORT_PLUGIN2(xatp, PluginClassName)
    To copy to clipboard, switch view to plain text mode 

    App (main.cpp):
    Qt Code:
    1. Q_IMPORT_PLUGIN(xatp)
    To copy to clipboard, switch view to plain text mode 

    In case it still doesn't work, try going through the plug and paint example and your project side by side comparing used macros and file/class names. If still in doubt, attach the project and we'll take a look.

    PS. The plug and paint example can be found in <QTDIR>\examples\tools\plugandpaint and <QTDIR>\examples\tools\plugandpaintplugins. You're especially interested into basic tools plugin which is static.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    Rodrigo (11th July 2007)

  4. #3
    Join Date
    May 2007
    Location
    Brazil
    Posts
    9
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problems loading static plugins

    Thanks JPN, i fixed the macro Q_EXPORT_PLUGIN2 and now it works perfectly!

    Bye!

Similar Threads

  1. Designer log messages while loading plugins
    By cocheci in forum Qt Tools
    Replies: 3
    Last Post: 18th May 2006, 14:50

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.