Mustafa
Mustafa

Reputation: 981

Qt compiling error 1

When i try to compile my program i get this

error: [tmp/moc/debug_shared/moc_window.cpp] Error 1

I have a class called Window. when I comment the Q_OBJECT line it compiles, but I can't use any slots.

class Window : public QWidget {
  // Q_OBJECT
public:
  Window();
public slots:
  void update();
};

I have QT 4.7 installed.

Any Idea why it doesn't compile when I uncomment the Q_OBJECT line? Thanks for any help.

Upvotes: 2

Views: 4090

Answers (2)

ismail
ismail

Reputation: 47592

You have a slot so you must have the Q_OBJECT macro, after adding this do a clean build. And in case of an error, post the whole error log not the last line.

Upvotes: 1

Raiv
Raiv

Reputation: 5781

maybe something is wrong with Moc paths... make sure that you have write rights in folder you use for moc-ing qt headers. ( tmp/moc/debug_shared/ ). And I don't know this extractly for linux, but on windows directory where you generating moc files must exist.

Upvotes: 0

Related Questions