Hello,

Im trying to make some small programs with QT4. Everyting goes well untill I want to create my own widgets with the Q_OBJECT in a class.
Then I can't compile the thing anymore.
It says:

Undefined symbols:
  "vtable for Communicate", referenced from:
      __ZTV11Communicate$non_lazy_ptr in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

What did I do wrong? I just copy-pasted some code from a tutorial.
http://www.zetcode.com/tutorials/qt4tutorial/firstprograms/
It's the communicate example at the bottom. The only difference with my code is that I've put everything in one file. I know it isn't supposed to be done that way but I just want to learn QT4.

I've already tried reinstalling QT4 but it didn't help.
I'm running Snow Leopard if it makes any difference.

Thanks

Did you go through all of the

qmake -project    (regardless of your project name)
qmake projname.pro (your projects C++ file name+.pro)
make

steps. If not, try that. If you have done it, try dividing it up into the three files to see what happens. Qt works with a lot of macros and something out of place could gum up the works.

P.S. There's a free pdf (released by the author under Open Publication) at http://www.qtrac.eu/marksummerfield.html (the author's website). Regrettably, I never finished it but I got through the bulk of it. He develops a very very rudimentary spreadsheet application but it's neat to see the inner machinations.

Well I've divided it into 3 files and now it works.
So from now on doing it the right way and not in a hurry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.