このQTヘッダーファイルがMOCによって解析されないのはなぜですか?
-
13-10-2019 - |
質問
QTで新しい「C ++ライブラリ」プロジェクトを作成しました。これには、次のヘッダーファイルがあります。
#include "Test_global.h"
#include <QString>
#include <QTcpServer>
class TESTSHARED_EXPORT Test : QTcpServer
{
Q_OJECT
public:
Test();
~Test();
signals:
void NewMessage(QString);
};
(実装ファイルは基本的に空です。)
オブジェクトを作成しようとすると、エラーが発生します。
Test.h:8: error: ISO C++ forbids declaration of ‘Q_OJECT’ with no type Test.h:10: error: expected ‘;’ before ‘public’ Test.cpp:3: error: definition of implicitly-declared 'Test::Test()'
だからそうです moc
ファイルをまったく処理していません。何が間違っていましたか?
解決
そのはず Q_OBJECT
, 、 いいえ Q_OJECT
.
所属していません StackOverflow