开发者

Why does this Qt header file fail to get parsed by moc?

I created a new 'C++ library' project in Qt, which has the following header file:

#include "Test_global.h"

#includ开发者_运维百科e <QString>
#include <QTcpServer>

class TESTSHARED_EXPORT Test : QTcpServer
{
    Q_OJECT

public:

    Test();
    ~Test();

signals:

    void NewMessage(QString);
};

(The implementation file is basically empty.)

When I try to build the object, I get errors:

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()'

So it looks like moc isn't processing the file at all. What have I done wrong?


It should be Q_OBJECT, not Q_OJECT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜