Results 1 to 10 of 10

Thread: QPluginLoader not load plugin

  1. #1
    Join Date
    Feb 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QPluginLoader not load plugin

    Hello,

    I have a problem, when I use QPluginLoader,the return is empty. But the path it is correct.

    This is my code:

    Qt Code:
    1. QDir dir( QCoreApplication::applicationDirPath());
    2. dir.cdUp();
    3. dir.cd("portal");
    4.  
    5. qDebug() << dir.absoluteFilePath(fileName);
    6. QPluginLoader loader(" dir.absoluteFilePath(fileName)");
    7.  
    8. qDebug() << loader.isLoaded();
    9. qDebug() << loader.errorString();
    10. QObject *plugin = loader.instance();
    To copy to clipboard, switch view to plain text mode 

    The result in line :

    1. qDebug() << dir.absoluteFilePath(fileName); is "path this is right", including the name file.

    2. qDebug() << loader.isLoaded(); is "false"

    3. qDebug() << loader.errorString(); is "unknow error".

    and line:

    Please, help me. =)

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPluginLoader not load plugin

    Does the plugin have the Q_EXPORT_PLUGIN2 macro?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPluginLoader not load plugin

    At line 6 you ask QPluginLoader to load a plugin called literally: " dir.absoluteFilePath(fileName)"

    Remove the quotes.

  4. #4
    Join Date
    Feb 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPluginLoader not load plugin

    Hi,

    I remove the quotes, but did not difference.

    Other question, where I put the macro Q_EXPORT_PLUGIN2 ?

    Thank you very much.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPluginLoader not load plugin

    In the implementation of the plugin, just like the docs state.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPluginLoader not load plugin

    The problem is that, I not create the file .dll, he already exist in folder of project.

    I just want import or load this file. That will I have that create the file .dll, ever that the project is compiled ?

    thank you.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPluginLoader not load plugin

    I don't understand what you mean. But to use the plugin, the macro needs to be there. You need to check if it is there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPluginLoader not load plugin

    I think Thyago.celler wants to dynamically load an arbitrary library, not a Qt plugin. The correct class for this would be QLibrary not QPluginLoader.

  9. #9
    Join Date
    Feb 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPluginLoader not load plugin

    But the that I'm doing this correct, but it returns me the following error :

    Use incompatible Qt library. Expected build key ""Windows mingw debug full-config"" got, "Windows mingw release full-config";

    Someone hnow the that can be this and why ?

    Thank you.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPluginLoader not load plugin

    Your application is built in debug mode and the library is built in release mode. They have to be built in the same mode (either debug or release).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QPluginloader load plugin from RAM
    By meCHAoT in forum Qt Programming
    Replies: 3
    Last Post: 3rd February 2011, 17:23
  2. Why can Qt Creator use QPluginLoader to load plugins?
    By MorrisLiang in forum Qt Programming
    Replies: 4
    Last Post: 25th April 2010, 16:00
  3. Replies: 8
    Last Post: 27th December 2009, 14:57
  4. QPluginLoader doesn't load plugin
    By BeS in forum Qt Programming
    Replies: 6
    Last Post: 26th November 2008, 19:12
  5. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13

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.