[Qt-interest] 'foreach' macro collision

Alessandro Portale alessandro.portale at nokia.com
Thu Nov 18 23:08:55 CET 2010


Try adding "CONFIG += no_keywords" to your .pro file. According to 
http://doc.qt.nokia.com/latest/qtglobal.html#foreach this should disable 
Qt's foreach.
And if you still want to use Qt's foreach, then you should be able to 
use Q_FOREACH, instead.

Let us know if it helps :)

On 11/18/2010 11:01 PM, ext Jake Colman wrote:
> We are upgrading from Qt3 to Qt4.  The Qt4 'foreach' macro collides with
> a our own macro of the same name.  Is there anything I can do, short of
> renaming my own 'foreach', to disambiguate the macros?  I'm pretty sure
> I'm screwed but maybe there is a C++ feature that I am not aware of that
> can help me.
>
> Thanks.




More information about the Qt-interest-old mailing list