[Qt-interest] 'AutoMoc' as prebuild event in msvc2008

j j at dynamica.org
Tue Dec 15 02:04:53 CET 2009



well, first because I didn't know that and I'm quite new to Qt, 
so, thanks, but doesn't qmake just generate a makefile which I then
have to compile with nmake ? 

J

Why not just run qmake which does exactly the same thing?

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of j
Sent: Monday, December 14, 2009 12:49 PM
To: qt-interest at trolltech.com
Cc: Daniel Dekkers
Subject: [Qt-interest] 'AutoMoc' as prebuild event in msvc2008


Hi there,

In setting up my msvc2008 environment for use with Qt-4.6
I found it quite convenient to have an 'AutoMoc' python script
as a prebuild event. The script scans the $(projectDir) recursively
for .h files that contain 'Q_OBJECT' and then runs moc.exe on them,
generating a moc_filename.h in the same folder. the arguments to 
moc can be provided as well, so you just need to add the call to
the python script as a prebuild event, add an #include "moc_filename.h"
to your corresponding .cpp file, and all should be well.
the script can be found here: 

http://www.dynamica.org/PUB/AutoMoc/AutoMoc.htm

regards,

Jochem van der Spek




More information about the Qt-interest-old mailing list