Hi all!
I am used to do plugins on ubuntu but now I need to do some on windows and it's just not working.
this code works prefecty on ubuntu: (of couse the destination folder is different)
Loader Class main.cpp
#include <QtGui>
#include <QtCore>
#include <QApplication>
#include <QMessageBox>
#include <iostream>
using namespace std;
#include "C:\Dokumente und Einstellungen\itadmin\workspaceTest\LDMS\ILDMS.h"
int main(int argc, char *argv[])
{
QObject *plugin
= loader.
instance();
if(plugin){
msgBox.setText("Loaded");
msgBox.exec();
}else{
msgBox.setText("Not loaded");
msgBox.exec();
}
return a.exec();
}
#include <QtGui>
#include <QtCore>
#include <QApplication>
#include <QMessageBox>
#include <iostream>
using namespace std;
#include "C:\Dokumente und Einstellungen\itadmin\workspaceTest\LDMS\ILDMS.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPluginLoader loader("C:\esp\plugins\LDMS.dll");
QObject *plugin = loader.instance();
if(plugin){
QMessageBox msgBox;
msgBox.setText("Loaded");
msgBox.exec();
}else{
QMessageBox msgBox;
msgBox.setText("Not loaded");
msgBox.exec();
}
return a.exec();
}
To copy to clipboard, switch view to plain text mode
pro file
TEMPLATE = app
TARGET = GuiLoaderPlugin
QT += core \
gui
HEADERS +=
SOURCES += main.cpp
FORMS +=
RESOURCES +=
TEMPLATE = app
TARGET = GuiLoaderPlugin
QT += core \
gui
HEADERS +=
SOURCES += main.cpp
FORMS +=
RESOURCES +=
To copy to clipboard, switch view to plain text mode
Plugin .cpp
#include "ldms.h"
void LDMS::init(){
ui.setupUi(this);
}
#include "ldms.h"
void LDMS::init(){
ui.setupUi(this);
}
To copy to clipboard, switch view to plain text mode
.h
#ifndef LDMS_H
#define LDMS_H
#include <QtGui/QWidget>
#include "ui_ldms.h"
#include "ILDMS.h"
public ILDMS
{
Q_OBJECT
Q_INTERFACES(ILDMS)
public:
void init();
private:
Ui::LDMSClass ui;
};
#endif // LDMS_H
#ifndef LDMS_H
#define LDMS_H
#include <QtGui/QWidget>
#include "ui_ldms.h"
#include "ILDMS.h"
class LDMS : public QWidget,
public ILDMS
{
Q_OBJECT
Q_INTERFACES(ILDMS)
public:
void init();
private:
Ui::LDMSClass ui;
};
#endif // LDMS_H
To copy to clipboard, switch view to plain text mode
interface
#ifndef ILDMS_H_
#define ILDMS_H_
#include <QtCore>
class ILDMS {
public:
virtual void init() = 0;
};
Q_DECLARE_INTERFACE(ILDMS,
"esp.ibex/1.0")
#endif /* ILDMS_H_ */
#ifndef ILDMS_H_
#define ILDMS_H_
#include <QtCore>
class ILDMS {
public:
virtual void init() = 0;
};
Q_DECLARE_INTERFACE(ILDMS,
"esp.ibex/1.0")
#endif /* ILDMS_H_ */
To copy to clipboard, switch view to plain text mode
pro file
TEMPLATE = lib
CONFIG += plugin
DESTDIR = C:\esp\plugins
TARGET = LDMS
QT += core \
gui
HEADERS += ILDMS.h \
ldms.h
SOURCES += ldms.cpp
FORMS += ldms.ui
RESOURCES +=
TEMPLATE = lib
CONFIG += plugin
DESTDIR = C:\esp\plugins
TARGET = LDMS
QT += core \
gui
HEADERS += ILDMS.h \
ldms.h
SOURCES += ldms.cpp
FORMS += ldms.ui
RESOURCES +=
To copy to clipboard, switch view to plain text mode
this works perfectly with ubuntu but on windows I just keep getting "Not loaded" messages.
Thanks in advance!
Bookmarks