Question

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

#include "Test_global.h"

#include <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?

Was it helpful?

Solution

It should be Q_OBJECT, not Q_OJECT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top