mercredi 21 octobre 2020

Q_DECLARE_INTERFACE for plugin creation throws errors all over

Environment:

  • Framework: Qt 5.12.9
  • Compiler: MSVC 15.9.28307.1234 (x64)
  • Debugger: CDB 10.017763.132 (x64)
  • Standard: C++11
  • Editor: Qt Creator 4.12.2
  • OS: Win10 Enterprise 1809

I want to develop an application that can be expanded through plug-ins. Therefore I created a standard library project where I want to define the plug-in interfaces. This library should then be consumed by the main application and its plug-ins.

I read about the Qt plug-in system on the official websites and sought help by duckduckgo-ing, but I'm stuck with these following errors:

  • vccplugin.h:16:32: error: expected parameter declarator vccplugin.h:14:23: note: expanded from macro 'VccPlugin_iid'
  • vccplugin.h:16:32: error: expected ')' vccplugin.h:14:23: note: expanded from macro 'VccPlugin_iid' vccplugin.h:16:20: note: to match this '('
  • vccplugin.h:16:1: error: C++ requires a type specifier for all declarations
  • Build Issue: C2059: syntax error: 'string'

This is the code:

#ifndef VCCPLUGIN_H
#define VCCPLUGIN_H

#include "VccPluginInterface_global.h"

class VCCPLUGININTERFACE_EXPORT VccPlugin
{
public:
    VccPlugin();
    ~VccPlugin();
    void DoeEenTwuk();
};

#define VccPlugin_iid "automation.general.vcc.interface"

Q_DECLARE_INTERFACE(VccPlugin, VccPlugin_iid);

#endif // VCCPLUGIN_H

Also note, I have little experience in both C++ and Qt.

Any help very appreciated, thanks

Aucun commentaire:

Enregistrer un commentaire