0

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 missing...? 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 
1
  • 1
    Some nitpicks... why is some but not all of the code ifdefed? Also, you probably want a slightly more specific ifdef. In addition, you have the includes thrown together in what appears to be a random order. I usually find it helpful to include standard headers all together, then Qt headers all together, and finally my local headers all together. This way I can see at a glance what Qt objects are used, for example. Commented Nov 22, 2009 at 16:02

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

Comments

2

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

Or was this not the case with QT3 ?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.