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

Jan Krause jan.krause.no19 at gmail.com
Tue Jan 22 20:31:09 CET 2013


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...

Cheers
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130122/887c3ab2/attachment.html>


More information about the Development mailing list