[Qt-interest] namespace pollution?

Konrad Rosenbaum konrad at silmor.de
Mon Sep 13 21:52:07 CEST 2010


On Monday 13 September 2010, FÖLDY Lajos wrote:
> I have encountered some strange error messages with my program. The
> problem was caused by qobjectdefs.h defining an empty macro emit:
> 
>      #include <QtGui/QtGui>
>      void emit() {}
> 
> qt.cc:2:11: error: expected unqualified-id before ')' token
> 
> How can I get a complete list of similar 'reserved words' in Qt?

#define emit
#define slots
#define signals protected

SLOT and SIGNAL are a tad more complex definitions

Anything that starts Q_ or QT_ is used by Qt for various reasons.

Anything that starts with an underscore (_) is reserved by C/C++.

So your statement above equates to: void(){} - which is an illegal 
expression, which confused the compiler.

You can get a list of all statements that are currently defined with a 
command like this:
--qd.cpp--
#include<Qt/QtCore>
#include<Qt/QtGui>
----
g++ -I /usr/local/Trolltech/Qt-4.6.3/include/ -dM -E qd.cpp

(-E instructs g++ to only do preprocessing, -dM instructs it to output all 
definitions instead of the preprocessed source)




	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100913/8605ef5e/attachment.bin 


More information about the Qt-interest-old mailing list