我所收到的错误:
g++ -c -g -I/usr/lib/qt-3.3/include TCPEchoServer.cpp
Product.h:22:错误: ISO C++禁止不带任何类型的âQ_Objectâ声明
Product.h:24:错误:预期;
制造:* 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发布于 2009-11-22 09:52:07
宏缺少正确的大小写,应该是Q_OBJECT。
发布于 2009-11-22 10:29:01
QObject应该以某种方式继承QObject类.
或者QT3不是这样的吗?
https://stackoverflow.com/questions/1778279
复制相似问题