Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

QT5 moc cannot parse __declspec instruction

$
0
0
I am currently migrating a project from QT4 to QT5. I am now facing a problem that has not been there when using QT4 regarding dllexport and dllimport. Whenever declaring __declspec(..) for a method within the slots scope, the moc is returning a parse error. I have created a small, artificial example. qt5test.h #ifndef QT5TEST2_H #define QT5TEST2_H   #include <QtWidgets/QMainWindow> #include "ui_qt5test2.h"   class qt5test2 : public QMainWindow {  Q_OBJECT   public:  qt5test2(QWidget *parent = 0);  ~qt5test2();   public slots:  __declspec(dllexport) void highlightSomething();     private:  Ui::qt5test2Class ui; };   #endif // QT5TEST2_H qt5test2.cpp #include "qt5test2.h"   qt5test2::qt5test2(QWidget *parent)  : QMainWindow(parent) {  ui.setupUi(this); }   qt5test2::~qt5test2() {   }     void qt5test2::highlightSomething() {   } Output 1>------ Rebuild All started: Project: qt5test2, Configuration: Debug Win32 ------ 1>  Moc'ing qt5test2.h... 1>  C:\Users\jcornelis\documents\qt5test\qt5test2\qt5test2\qt5test2.h(16): Parse error at ")" Am i doing something wrong? I am a bit confused, since the project compiled flawlessly against Qt4.8.

Viewing all articles
Browse latest Browse all 18427

Trending Articles