[Development] [semi-solved] Qt5 moc error in combination with boost

Knoll Lars Lars.Knoll at digia.com
Fri Jan 25 21:34:40 CET 2013


On Jan 22, 2013, at 8:31 PM, Jan Krause <jan.krause.no19 at gmail.com<mailto:jan.krause.no19 at gmail.com>> wrote:

Am 22.01.2013 14:58, schrieb Olivier Goffart:

On Tuesday 22 January 2013 06:32:45 Charley Bay wrote:


There's a Qt5 moc error when using Boost, with a work-around.  See:
http://qt-project.org/forums/viewthread/22993

It describes "Boost 1.49", but this work-around also works for "Boost 1.52":

...leads to compile error (Win7/MSVS2010):

C:/Some/Path/3rd/Boost/boost_1_52_0/boost/mpl/if.hpp(131): Error: Macro
argument mismatch.
Project : error PRJ0019: A tool returned an error code from "MOC
..\..\Some\Path\MyClass.hpp"

Work-around, in ALL files that "moc":

//...USING BOOST, MUST GUARD INCLUSION...
#ifndef Q_MOC_RUN
# include <boost/function.hpp>
# include "MyClass.hpp"
#endif // Q_MOC_RUN

We're not using much of Boost 1.52, but we *do* use some of the
"type/traits" stuff (which triggers this error).

There are a few "Boost/moc" errors/bugs reported in
https://bugreports.qt-project.org/, but I couldn't find this one.  Did I
miss it, or should I create a new one?

I'm specifically curious about when this might be fixed, as the work-around
is annoying (I haven't looked into what the fix might be).

Thanks!

--charley


I have boost 1.50 here and I cannot reproduce the issue.

Please open a new bug report and if possible, a small test-case that does not
depends on boost.
Try to copy all the involved macro in a file.



I have maybe the same/similiar error (qt5.0, boost 1.52). After including

#include <boost/uuid/uuid.hpp>

#include <boost/uuid/random_generator.hpp>



in a qt-header file, I get the error

boost/mpl/if.hpp(131): Error: Macro argument mismatch.

during compiling of the correspondence moc_...cpp file. It looks like a preprocessor error messageā€¦

Could you please file a bug report in Jira for this? Ideally with a test case (and the exact boost version).

moc is now (since 5.0) parsing preprocessor statements (which fixes many other bugs). I thought I had all problems fixed, but boost headers are extremely evil with macros.

Thanks,
Lars

Cheers
Jan
_______________________________________________
Development mailing list
Development at qt-project.org<mailto:Development at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130125/5383cc47/attachment.html>


More information about the Development mailing list