Expected constructor, destructor, or type conversion before ‘(’ token



  • i get this error at the line where i to let Qt to know that the ActionPlugin class is a plugin

    @#include "actionplugin.h"

    QAction* ActionInterface::newAction() {

    QAction *pluginAction = new QAction(NULL);

    return pluginAction;
    

    }

    Q_EXPORT_PLUGIN2(actionplugin,ActionPlugin); // here is the problem@

    That can be ?



  • You are obviously trying to export a class named ActionPlugin, whereas at least newAction() is a member of a class called ActionInterface. There is no such class called ActionPlugin, at least not in the piece of code you've posted, neither did you include <QtPlugin>.



  • header file looks like (in previsious code snippet i show just impelmentation of method from an interface)

    @#ifndef ACTIONPLUGIN_H
    #define ACTIONPLUGIN_H

    #include <QObject>
    #include <QAction>
    #include "actioninterface.h"

    class ActionPlugin : public QObject,ActionInterface {

    Q_OBJECT
    Q_INTERFACES (ActionInterface)
    

    public :
    QAction* newAction() const;

    ~ActionPlugin () {}
    ActionPlugin () {}
    

    };

    #endif // ACTIONPLUGIN_H@



  • [quote author="veverita" date="1322065840"](in previsious code snippet i show just impelmentation of method from an interface)[/quote]

    If ActionPlugin should implement the interface method newAction() it has to read ActionPlugin::newAction(), not ActionInterface::newAction().



  • [quote author="Lukas Geyer" date="1322067716"][quote author="veverita" date="1322065840"](in previsious code snippet i show just impelmentation of method from an interface)[/quote]

    If ActionPlugin should implement the interface method newAction() it has to read ActionPlugin::newAction(), not ActionInterface::newAction().[/quote]

    still same issue



  • you should inherit ActionInterface public, otherwise it's private...



  • [quote author="Gerolf" date="1322070111"]you should inherit ActionInterface public, otherwise it's private...[/quote]

    done , but do not solve problem ... may be Compile Output helps

    @../GUI/actionplugin.cpp:10:18: error: expected constructor, destructor, or type conversion before ‘(’ token
    make: Leaving directory `/home/parallels/Documents/GUI-build-desktop'
    make: *** [actionplugin.o] Error 1
    The process "/usr/bin/make" exited with code 2.
    Error while building project GUI (target: Desktop)
    When executing build step 'Make'@



  • Is that a literal paste of your code? The trailing ';' is an error.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.