Friday, September 28, 2012

Boost 1.48+, BOOST_JOIN, and Qt

(September 29, 2012)

I am using Visual C++ 2010, Boost Library, and Qt (of course, with some other libraries such as OpenCV, but they are not relevant). This combination can lead to headache if Boost version is 1.48+ (mine is 1.51) and Qt 4.7.3+ (mine is 4.8.3).  The problem prevents us from successful compile and we will get Parse error at "BOOST_JOIN". The error message I got from Visual C++ 2010 is boost_1_51_0/boost/type_traits/detail/has_binary_operator.hp(50): Parse error at "BOOST_JOIN”.  This problem occurred during Qt’s Moc'ing.

A file in Boost that causes this error message can be varied.  Mine was boost/type_traits/detail/has_binary_operator.hp, but other people seemed to encounter a similar error in other files.  The discussion is available at  The cause of the issue is Qt’s moc.exe. 

Fortunately, we can solve the issue by doing something with moc’s parameters. To be exact, we can solve the issue by sending an option 
to moc. If you install Qt VS Addin, you can right click a project and choose ‘Qt project settings.’ There, you set the MocOptions as shown in a figure below.


No comments: