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

Olivier Goffart olivier at woboq.com
Tue Jan 22 14:58:39 CET 2013


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.

-- 
Olivier

Woboq - Qt services and support - http://woboq.com





More information about the Development mailing list