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.