I'm getting the error Parse error at "BOOST_JOIN"
while trying to compile a code with Qt4 and CGAL. I'm not using Boost directly and I've already searched and tried a bunch of options like -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
and -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
. The versions I'm working with are CGAL 4.1.0, Qt 4.8.4_6 and Boost 1.53.0_1, and using CMake to generate the Makefile, in a machine Mac OS 10.8.2. Any ideas of what could be causing that error?
This problem happens in Boost 1.56.0 with QT 4.7.4 (which is quite old now),
Regardless, another quick workaround is to edit the problematic boost header files, and
add to the top:
#ifndef Q_MOC_RUN
add to the bottom:
#endif
This will at least let MOC run without dying.
When you compile a piece of code that defines Qt objects, the build system needs to call the Qt Meta Object Compiler, aka "moc". In Qt versions before 5.0, the "moc" compiler (actually a precompiler) does not parse correctly all C++ code. In particular, it does not fully expand preprocessor macros. In recent Boost versions, some macros (like that BOOST_JOIN) are sometimes used to define a namespace name. For example:
namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) {
in boost/type_traits/detail/has_binary_operator.hpp
of Boost version 1.53.
A Qt bug has being filled at Qt-Project.org and is said to be fixed in Qt-5.0.
In CGAL-4.2, I have tried to suppress those build errors by separating more the use of Qt and Boost in different compilation units. You should retry with a recent version of Boost, and CGAL-4.2-beta1 (or later versions if they are released when you read that answer). Let me know if you encounter similar problems with CGAL-4.2-beta1 or later.
As for Qt-5.0, I hope CGAL-4.3 will support it. We will have to work on the CMake scripts to support it. It will be added to the planning of the next CGAL developers meeting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With