[Boost-users] has_binary_operator.hpp error

1,617 views
Skip to first unread message

Panagiotis Foteinos

unread,
Nov 16, 2011, 12:58:04 PM11/16/11
to boost...@lists.boost.org
Hello list.

I just upgraded my system to the newest version of boost, i.e.,
1.48.0. Boost compiled just fine.

However, I recompile my applications (that link to boost) and I get
the following error:

******************************************************************
usr/local/include/boost/type_traits/detail/has_binary_operator.hp:50:
Parse error at "BOOST_JOIN"
******************************************************************


Any suggestions?

Regards,
Panagiotis Foteinos
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Lothar

unread,
Nov 17, 2011, 4:32:12 PM11/17/11
to boost...@lists.boost.org
Hi,

Panagiotis Foteinos writes:

>
> Hello list.
>
> I just upgraded my system to the newest version of boost, i.e.,
> 1.48.0. Boost compiled just fine.
>
> However, I recompile my applications (that link to boost) and I get
> the following error:
>
> ******************************************************************
> usr/local/include/boost/type_traits/detail/has_binary_operator.hp:50:
> Parse error at "BOOST_JOIN"
> ******************************************************************
>
> Any suggestions?
>
> Regards,
> Panagiotis Foteinos
>

I could reproduce this. It occurs when building CGAL 3.8. It is not a compiler
error, instead it is an error of Qt generating the moc-file (the "moc" program
of Qt). For some reason, boost is included in this file where moc is run. As you
see the last step is

[ 29%] Generating __/__/include/CGAL/Qt/moc_GraphicsItem.cxx

which is not a compiler step.

I suppose that this either needs a fix in CGAL, or in Qt in the moc generator.
However, I don't know a quick fix for this...

Regards,
Lothar

Mark Brand

unread,
Nov 17, 2011, 7:16:44 PM11/17/11
to boost...@lists.boost.org
>
> I suppose that this either needs a fix in CGAL, or in Qt in the moc generator.
> However, I don't know a quick fix for this...
>
> Regards,
> Lothar
>

In case it helps the OP, I just proposed a patch to CGAL:

https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2011-11/msg00087.html

Mark

Panagiotis Foteinos

unread,
Nov 18, 2011, 10:54:12 AM11/18/11
to boost...@lists.boost.org
Thank you guys; yes, the error occurs when compiling CGAL.

This conversation seems more relevant inside CGAL's mailing list.

Regards,
Panagiotis

Frédéric Bron

unread,
Nov 18, 2011, 2:35:23 PM11/18/11
to boost...@lists.boost.org
> I just upgraded my system to the newest version of boost, i.e.,
> 1.48.0. Boost compiled just fine.
>
> However, I recompile my applications (that link to boost) and I get
> the following error:
>
> ******************************************************************
> usr/local/include/boost/type_traits/detail/has_binary_operator.hp:50:
> Parse error at "BOOST_JOIN"

This file is new to this release. Then you probably did not include it
yourself in your "old" code.
So I think that a simple fix would be to replace somewhere in your code:

#include <boost/type_traits.hpp> // this includes everthing from type_traits

by the list of #include you really need:

#include <boost/type_traits/header1.hpp>
#include <boost/type_traits/header2.hpp>
#include <boost/type_traits/header3.hpp>
...

Regards,
Frédéric

qplace

unread,
Nov 18, 2011, 3:01:29 PM11/18/11
to boost...@lists.boost.org
Frédéric Bron <frederic.bron <at> m4x.org> writes:

> > ******************************************************************
> > usr/local/include/boost/type_traits/detail/has_binary_operator.hp:50:
> > Parse error at "BOOST_JOIN"
>
> This file is new to this release. Then you probably did not include it
> yourself in your "old" code.
> So I think that a simple fix would be to replace somewhere in your code:
>
> #include <boost/type_traits.hpp> // this includes everthing from type_traits

> ...
>
> Regards,
> Frédéric
>

I am having exactly the same problem, compiling boost+Qt sources with 1.48
release of boost. What might be of interest for everyone having this problem is
that in my case I don't explicitly specify #include <boost/type_traits.hpp> in
code. It might be used in some other boost headers that I have plenty in my
code.

I have to fallback to 1.47.

I think that this issue will affect large population of boost users, since many
are using Qt.

Frédéric Bron

unread,
Nov 18, 2011, 3:43:06 PM11/18/11
to boost...@lists.boost.org
> I am having exactly the same problem, compiling boost+Qt sources with 1.48
> release of boost. What might be of interest for everyone having this problem is
> that in my case I don't explicitly specify  #include <boost/type_traits.hpp> in
> code. It might be used in some other boost headers that I have plenty in my
> code.

It would help if somebody could give the output of the preprocessor.
With g++, just add -E option and compile one failing file.
This may help understand the error with BOOST_JOIN. Is there #undef
BOOST_JOIN somewhere?
Frédéric

Mark Brand

unread,
Nov 18, 2011, 4:20:00 PM11/18/11
to boost...@lists.boost.org
Frédéric Bron wrote:
>> I am having exactly the same problem, compiling boost+Qt sources with 1.48
>> release of boost. What might be of interest for everyone having this problem is
>> that in my case I don't explicitly specify #include<boost/type_traits.hpp> in
>> code. It might be used in some other boost headers that I have plenty in my
>> code.
> It would help if somebody could give the output of the preprocessor.
> With g++, just add -E option and compile one failing file.
> This may help understand the error with BOOST_JOIN. Is there #undef
> BOOST_JOIN somewhere?
> Frédéric
>

Hi Frédéric,

It's not the C++ preprocessor, but Qt's moc that chokes on BOOST_JOIN.
The workaround I proposed to the CGAL list at
https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2011-11/msg00087.html
just instructs the moc preprocessor to skip the #include that introduces
BOOST_JOIN.

Mark

Frédéric Bron

unread,
Nov 19, 2011, 12:06:11 AM11/19/11
to Mark Brand, boost...@lists.boost.org
> It's not the C++ preprocessor, but Qt's moc that chokes on BOOST_JOIN. The
> workaround I proposed to the CGAL list at
> https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2011-11/msg00087.html
> just instructs the moc preprocessor to skip the #include that introduces
> BOOST_JOIN.

OK, I do not know this moc. I understand it reads the files and tries
to understand the syntax which fails for some reasons here. So there
is nothing to do in boost then.
It is strange that it appears now because BOOST_JOIN was already used
in other files in 1.47.0.

Frédéric

Jürgen Hunold

unread,
Nov 19, 2011, 3:44:07 PM11/19/11
to boost...@lists.boost.org
Hi Frédéric,

On Saturday, 19. November 2011 06:06:11 Frédéric Bron wrote:
> > It's not the C++ preprocessor, but Qt's moc that chokes on BOOST_JOIN.
> > The workaround I proposed to the CGAL list at
> > https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2011-11/msg00087.html
> > just instructs the moc preprocessor to skip the #include that introduces
> > BOOST_JOIN.
>
> OK, I do not know this moc. I understand it reads the files and tries
> to understand the syntax which fails for some reasons here. So there
> is nothing to do in boost then.

Well, we've been bitten by this one, too. The way to solve this is to file a
bug report at Qts bugtracker so they can improve the moc. In the meantime
client code just has to put #ifndef Q_MOC_RUN around the critical places.

> It is strange that it appears now because BOOST_JOIN was already used
> in other files in 1.47.0.

Well, the moc has improved a lot in Qt4, but nevertheless has only a parser
for a limited subset of c++ (and a limited preprocessor.) So this is no real
surprise, at least for me :-)

Yours,

Jürgen
--
Dipl.-Math. Jürgen Hunold | IVE mbH
Software-Entwickler | Lützerodestraße 10
Tel: +49 511 897668 33 | 30161 Hannover, Germany
Fax: +49 511 897668 29 | http://www.ivembh.de
juergen...@ivembh.de |
| Geschäftsführer:
Sitz des Unternehmens: Hannover | Univ.-Prof. Dr.-Ing. Thomas Siefer
Amtsgericht Hannover, HRB 56965 | PD Dr.-Ing. Alfons Radtke

Reply all
Reply to author
Forward
0 new messages