Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Expected constructor, destructor, or type conversion before ‘(’ token

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

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 7.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      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>.

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        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@

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          [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().

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #5

            [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

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

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

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              1 Reply Last reply
              0
              • ? This user is from outside of this forum
                ? This user is from outside of this forum
                Guest
                wrote on last edited by
                #7

                [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'@

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dangelog
                  wrote on last edited by
                  #8

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

                  Software Engineer
                  KDAB (UK) Ltd., a KDAB Group company

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved