Results 1 to 7 of 7

Thread: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

  1. #1
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    I am having this runtime error when trying to load a plugin with Qt's QPluginLoader.

    I am on windows 7 N x64 and VS2010.

    The error is:

    The plugin '[absolute path to the .DLL file]/TestPlugin.dll' uses incompatible Qt library. (4.8.2) [debug]
    Note that if I change build type to Release, the error shown is now

    The plugin '[absolute path to the .DLL file]/TestPlugin.dll' uses incompatible Qt library. (4.8.2) [release]
    This is the test code I am using:

    This is the Interface (it's both in the main app project and in the plugin project)
    Qt Code:
    1. #ifndef NEWTESTPLUGIN_H
    2. #define NEWTESTPLUGIN_H
    3.  
    4. class INewInterface
    5. {
    6. public
    7. virtual ~INewInterface() {}
    8. virtual void popUp() = 0;
    9. };
    10.  
    11. Q_DECLARE_INTERFACE( INewInterface , "NewInterface")
    12.  
    13. #endif //NEWTESTPLUGIN_H
    To copy to clipboard, switch view to plain text mode 

    My test plugin.h:

    Qt Code:
    1. #ifndef NEWTESTPLUGIN_H
    2. #define NEWTESTPLUGIN_H
    3.  
    4. #include "INewInterface.h"
    5. #include "QtGui\\qwidget.h"
    6. #include "QtGui\\qlabel.h"
    7. #include "QtGui\\qboxlayout.h"
    8. class NewTestPlugin : public QWidget, public INewInterface
    9. {
    10. Q_OBJECT
    11. Q_INTERFACES(INewInterface)
    12.  
    13. public:
    14. NewTestPlugin(QObject *parent = 0);
    15. void popUp();
    16. QVBoxLayout * m_layout;
    17. QLabel * m_label;
    18.  
    19. private:
    20. bool initialized;
    21. };
    22.  
    23. #endif // NEWTESTPLUGIN_H
    To copy to clipboard, switch view to plain text mode 

    and .cpp
    Qt Code:
    1. #include "customwidget.h"
    2.  
    3. #include <QtCore/QtPlugin>
    4. #include "newtestplugin.h"
    5.  
    6. NewTestPlugin::NewTestPlugin(QObject *parent)
    7. {
    8. m_label = new QLabel("ESTO ES UN PLUGIN!");
    9. m_layout = new QVBoxLayout();
    10. m_layout->addWidget(m_label);
    11. setLayout(m_layout);
    12. }
    13.  
    14. void NewTestPlugin::popUp()
    15. {
    16. this->show();
    17. }
    18.  
    19. Q_EXPORT_PLUGIN2(NewTestPlugin, NewTestPlugin)
    To copy to clipboard, switch view to plain text mode 

    This is how I try to load it:

    Qt Code:
    1. if(token==QXmlStreamReader::StartElement)
    2. {
    3. if(m_xmlRStream->name()=="Game")
    4. {
    5. QString textFromElement = m_xmlRStream->readElementText();
    6. QPushButton * button = new QPushButton(textFromElement, this);
    7. button->setMinimumSize(150, 150);
    8. m_mainLayout->addWidget(button);
    9.  
    10. //create a pluginLoader
    11. QPluginLoader loader("C:/Users/TestDllProject/Win32/Debug/TestPlugin.dll");
    12. QObject * plugin = loader.instance();
    13. if(plugin)
    14. {
    15. INewInterface* asd = qobject_cast<INewInterface*>(plugin);
    16. asd->popUp();
    17. }
    18. else
    19. {
    20. QMessageBox * pluginErrorMessageBox = new QMessageBox(this);
    21. pluginErrorMessageBox->information(this,"Error loading DLL","Requested DLL wasn't properly loaded.\n \n" + loader.errorString(), pluginErrorMessageBox->Ok);
    22. QPluginLoader loader("C:/Users/TestDllProject/Win32/Debug/NewTestPlugin.dll");
    23. QObject * plugin = loader.instance();
    24. if(plugin)
    25. {
    26. INewInterface* asd = qobject_cast<INewInterface*>(plugin);
    27. asd->popUp();
    28. }
    29. else
    30. {
    31. pluginErrorMessageBox = new QMessageBox(this);
    32. pluginErrorMessageBox->information(this,"Error loading DLL","Requested DLL wasn't properly loaded.\n \n" + loader.errorString(), pluginErrorMessageBox->Ok);
    33. exit(1);
    34. }
    35. }
    36. }
    To copy to clipboard, switch view to plain text mode 

    I honestly dont know what I am doing wrong, and all google found out had mostly nothing to do with what I am doing.

    I am using 4.8.2, for both the DLL and the .Exe (Also, they are both in the same solution).

    Any help on the issue would be greately appreciated.

    As always, if I am not providing appropiate info, please let me know what you need.

    Thank you.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    do you have other versions of qt on your machine?

    what version is the plugin built with?
    what version is the main app built with?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    The only version installed right now is 4.8.2 built with VS2010.
    I used to have 4.8.2 precompiled for VS2008, but deleted it shortly after to move onto VS2010.

    Both plugin and app are built in 4.8.2

  4. #4
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    UPDATE I Don't know what I did, but the error changed from the previous one to this:

    The file: [Path to dll].dll is not a valid Qt Plugin.

    Anyone with an appropiate insigth on this issue?
    Also, which is the difference between projects Qt4 Designer Plugin and Qt Library?

  5. #5
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    Could the .pro file (or lack of a .pro file, to be exact) be the issue here? When I created the project in visual studio 2010, it did not provide me with one.

    Is there a way to automatically generate one? Or at least a plugin .pro file's template?

  6. #6
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    It's been pointed out by a friend of mine that the question might not only be unclear, but it might even be misleading, so I will rewrite it here (because I am unable to edit original post)

    I am trying to compile a Qt Library Project to use its DLL as a plugin of my Main Application.
    I've come across this particular error and I cannot seem to get past it, no matter what I try.

    I believe cluttering the question with code tags is pointless when I can just provide you with the "working issue" (for lack of better wording).

    [This is a link to both projects. The main application AND the plugin I am currently testing on.]

    (please remember to modify the path in the Application project of the dll. I am using absolute path, which will most likely never be the same one you will use. I used absolute paths to make sure the problem was unrelated to finding the file itself)

    So far I've checked:

    * My Qt version is, indeed, 4.8.2. Built with VS2010 Command Prompt.
    * As far as I understood the documentation, my code (particularly the APlugin project) follows the documentation instructions word by word. There's some space for human error, but I believe I got it right. [as specified here(The Lower-Level API: Extending Qt Applications)]
    * I am able to generate other QPluginLoader::errorString() errors (for example, using an invalid path to the .dll file will return a "file not found" error). Thus diminishing the margin of error in its use.

    As of today, Google results are, at best, cryptic and/or do not apply to my current context of development (I am on VS2010, Win7 N Ultimate, Qt 4.8.2)

    I believe it's better that I provided projects where the issue is reproducible, instead of just cluttering the question with code, but if you think I still should copy-paste my code, let me know and I will provide it explicitely in the question.

    The only thing I am able to provide so far is that, albet I don't use a .pro file, I shouldn't need it, because my application will be windows exclusive, and the vcproj file already contains that data.
    Last edited by alitoh; 31st July 2012 at 20:19. Reason: updated contents

  7. #7
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: The plugin [path] uses incompatible Qt Library (4.8.2.) [Debug] (or [Release])

    worked for me but I checked a couple of settings and changed them before trying 'as supplied'.

    If you check the properties of generated files in debug/release (the moc_ files) you will see:

    For debug config, the debug file does not have any property set for 'exclude from build', whereas the release file has 'exclude from build' set to 'yes'.

    I just made sure the debug moc file has 'no' in that setting (for all moc files...).


    After I built both solutions with that change the plugin was loaded fine.

    I used studio 11 beta with studio 10 tools (studio 10 compilers etc.).


    e:
    win7 64 home prof.
    Qt: 4.6.0 (built with msvc2010 using msvc2008 makespecs)
    Last edited by amleto; 31st July 2012 at 21:44.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. Cannot mix incompatible Qt library
    By ycyclop in forum Installation and Deployment
    Replies: 0
    Last Post: 12th March 2012, 14:01
  2. Cannot mix incompatible Qt library
    By hubipet in forum Qt Programming
    Replies: 4
    Last Post: 13th February 2012, 20:03
  3. Loading plugin and "Incompatible Qt library" issue.
    By TorAn in forum Qt Programming
    Replies: 4
    Last Post: 31st May 2010, 14:04
  4. Release and debug destination path
    By mdecandia in forum Qt Programming
    Replies: 0
    Last Post: 18th May 2007, 15:45

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.