开发者

Q_Object with no type

开发者 https://www.devze.com 2022-12-11 23:22 出处:网络
The error I am receiving: g++ -c -g -I/usr/lib/qt-3.3/include TCPEchoServer.cpp Product.h:22: error: ISO C++ forbids declaration of âQ_Objectâ with no type

The error I am receiving:

g++ -c -g -I/usr/lib/qt-3.3/include TCPEchoServer.cpp

Product.h:22: error: ISO C++ forbids declaration of âQ_Objectâ with no type

Product.h:24: error: expected â;â before âvoidâ

make: *** [TCPEchoServer.o] Error 1

I'm using QT 3.3. What am I mis开发者_如何学Gosing...? T___T

#include <string>
#include <qtimer.h>
#include "HandleTCPClient.h"
#ifndef PRODUCT_H
#define PRODUCT_H
#include <qobject.h>
#include <qgl.h>

class Handler;

//Define ourselves a product class
class Product
    {

        Q_Object

        void startTimer();

    public:
        Product();

        string seller, itemName, description, highestBidder;
        double price, min, buyingPrice, currentBid;
        int time;
        bool isSold;
        Handler *handler;

        void setHandler(Handler *h);

    public slots:
        void setProductToSold();

    };

#endif


You are missing the correct case for the macro, it should be Q_OBJECT.


And, A QObject should inherit in some way from the class QObject...

Or was this not the case with QT3 ?

0

精彩评论

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