[Qt-interest] problem with signal/slot

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Thu Dec 9 13:41:47 CET 2010


On 2010-12-08 Mahendra Mahendra G.R wrote:

> ...
> Yes, i'm using eclipse actually, 

Whatever build system/IDE you are using, there should always be a window which shows the output of the compilation process (on stdout, for example).

In this output check whether the following build steps are called:

  moc <your file.h> -o moc_<your file.cpp> (or similar)
  g++ moc_<your_file.cpp> ... (or whatever compiler you are using)
  ldd ... moc_yourfile.o <rest of the object files) (or whatever linker you are using)

That is

1. the 'moc' tool must be called and process your header files

2. the generated moc_ files must be compiled and

3. linked to your application

With qmake based projects all these steps are done automagically, when

- your class derives from QObject
- contains the Q_OBJECT macro

For all other IDEs (Visual Studio, Eclipse, ...) you need to have the "Qt support" addins installed or manually take care about these "custom build steps".

If you are not sure whether your .h header is "moc'ed" correctly, do some dummy changes, save it and compile again. If you don't see a "moc" custom build step then something is wrong with your Eclipse Qt plugin/settings (I have never used the Eclipse Qt integration myself).

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22






More information about the Qt-interest-old mailing list