簡體   English   中英

Q_Object沒有類型

[英]Q_Object with no type

我收到的錯誤:

g ++ -c -g -I / usr / lib / qt-3.3 / include TCPEchoServer.cpp
Product.h:22:錯誤:ISO C ++禁止無類型的“ Q_Object”聲明
Product.h:24:錯誤:在“ void”之前預期“â”
make:*** [TCPEchoServer.o]錯誤1

我正在使用QT 3.3。 我想念什么...? 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

您缺少該宏的正確大小寫,它應該是Q_OBJECT

並且,QObject應該以某種方式從類QObject繼承。

還是QT3並非如此?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM