Making Application Plugin-Aware
Sorry for my english ...
I am trying to developer a Application Plugin-Aware
following the "C++ GUI Programming with Qt 4 - 2nd Edition" book, but i am having a lot of trouble.
- I am use the "QT Creator"
- I am in the windows
- If a understand, i have to create a .dll file that is is my plugin, and the main app will read.
- To make the plugin i choose the "C++ Library" option in the IDE
I am attach the interface and the class that implements its (the is the plugin)
Error:
expected class-name before '(' token - Iplugin.h 12
expected initializer before '*' token - Iplugin.h 18
return type `struct QStringList' is incomplete - pluginteste.cpp 5
invalid use of undefined type `struct QStringList' - pluginteste.cpp 6
forward declaration of `struct QStringList' - qstring.h 86
Code:
// Iplugin.h
#ifndef IPLUGIN_H
#define IPLUGIN_H
#include <QtPlugin>
class Iplugin
{
public:
virtual ~TextArtInterface() { }
};
Q_DECLARE_INTERFACE(TextArtInterface,
"com.software-inc.TextArt.TextArtInterface/1.0")
#endif // IPLUGIN_H
Code:
//pluginteste.h
#ifndef PLUGINTESTE_H
#define PLUGINTESTE_H
#include <QObject>
#include "Iplugin.h"
class Pluginteste
: public QObject ,
public Iplugin
{
Q_OBJECT
Q_INTERFACES(Iplugin)
public:
};
#endif // PLUGINTESTE_H
Code:
//pluginteste.cpp
#include "pluginteste.h"
{
return QStringList() <<
"Plain" <<
"Outline" <<
"Shadow";
}
Q_EXPORT_PLUGIN2(pluginteste, Pluginteste);
Code:
//pluginteste.pro
# -------------------------------------------------
# Project created by QtCreator 2009-04-22T20:24:13
# -------------------------------------------------
QT -= gui
TARGET = pluginteste
TEMPLATE = lib
CONFIG += plugin
SOURCES += pluginteste.cpp
HEADERS += pluginteste.h \
Iplugin.h
Re: Making Application Plugin-Aware
Hi,
Quote:
Originally Posted by
assismvla
expected class-name before '(' token - Iplugin.h 12
expected initializer before '*' token - Iplugin.h 18
This class has no constructor! Name of class and destructor doesn't match! Use also "#include <QStringList>."
Quote:
return type `struct QStringList' is incomplete - pluginteste.cpp 5
invalid use of undefined type `struct QStringList' - pluginteste.cpp 6
forward declaration of `struct QStringList' - qstring.h 86
Use "#include <QStringList>" in top of pluginteste.cpp
... class Pluginteste has also no constructor. Maybe you want first learn the basics of C++.
Re: Making Application Plugin-Aware
I am still recive this error menssages:
error: expected initializer before '*' token - Iplugin.h 18
error: expected initializer before '*' token - Iplugin.h 18
Here is the files ...
Code:
//Iplugin.h
#ifndef IPLUGIN_H
#define IPLUGIN_H
#include <QtPlugin>
#include <QStringList>
class Iplugin
{
public:
Iplugin();
virtual ~Iplugin();
};
Q_DECLARE_INTERFACE(TextArtInterface,
"com.software-inc.TextArt.TextArtInterface/1.0")
#endif // IPLUGIN_H
Code:
//pluginteste.h
#ifndef PLUGINTESTE_H
#define PLUGINTESTE_H
#include <QObject>
#include <QStringList>
#include "Iplugin.h"
class Pluginteste
: public QObject ,
public Iplugin
{
Q_OBJECT
Q_INTERFACES(Iplugin)
public:
Pluginteste();
~Pluginteste();
};
#endif // PLUGINTESTE_H
Code:
//pluginteste.cpp
#include "pluginteste.h"
#include <QStringList>
Pluginteste::Pluginteste()
{
}
Pluginteste::~Pluginteste()
{
}
{
return QStringList() <<
"Plain" <<
"Outline" <<
"Shadow";
}
Q_EXPORT_PLUGIN2(pluginteste, Pluginteste);
Re: Making Application Plugin-Aware
As your whole offered code doesn't contain a *, I suggest to clear all previously build things and compile new (rebuild).