Bad interaction between boost::bind and Boost.Python?

With the files newly unpacked from boost_1_31_0.zip, using MS VS .NET 2003 (aka 7.1), the following two-line source file: #include <boost/bind.hpp> #include <boost/python.hpp> compiled with the following command line: cl /c /I "c:/Dev/boost_1_31_0" /I "$PYTHONDIR/include" /EHsc test.cpp produces these errors: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. test.cpp c:/Dev\boost_1_31_0\boost\mpl\less.hpp(39) : error C2760: syntax error : expected ',' not ';' c:/Dev\boost_1_31_0\boost\mpl\less.hpp(51) : see reference to class template instantiation 'boost::mpl::less<T1,T2>' being compiled c:/Dev\boost_1_31_0\boost\mpl\less.hpp(39) : error C2144: syntax error : 'const bool' should be preceded by '}' c:/Dev\boost_1_31_0\boost\mpl\less.hpp(39) : error C2062: type 'const bool' unexpected c:/Dev\boost_1_31_0\boost\mpl\less.hpp(39) : error C2238: unexpected token(s) preceding ';' c:/Dev\boost_1_31_0\boost\mpl\less.hpp(42) : error C2065: 'value' : undeclared identifier Reversing the order of 'bind.hpp' and 'python.hpp' results in a clean compile. I'm trying to upgrade from Boost 1.30.2 to 1.31.0 today, but this bug is turning into quite a problem because of deep nesting of our own #include files. It hasn't yet become a show-stopper; but it's certainly taking me a great deal of effort to try to propagate every #include <boost/python*> -- and every file that includes it! - higher in its includer's #include list than any #include <boost/bind.hpp>. Please tell me there's a better way.

"Nat Goodspeed" <ngoodspeed@solidworks.com> writes:
I'm trying to upgrade from Boost 1.30.2 to 1.31.0 today, but this bug is turning into quite a problem because of deep nesting of our own #include files. It hasn't yet become a show-stopper; but it's certainly taking me a great deal of effort to try to propagate every #include <boost/python*> -- and every file that includes it! - higher in its includer's #include list than any #include <boost/bind.hpp>. Please tell me there's a better way.
In principle your boost/python header has to be #included first anyway, at least if you intend your code to run on POSIX. All I can suggest is that you try the latest Boost CVS state, which doesn't have this problem. A new release of Boost is imminent anyway. HTH, -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

Nat Goodspeed wrote:
With the files newly unpacked from boost_1_31_0.zip, using MS VS .NET 2003 (aka 7.1), the following two-line source file:
#include <boost/bind.hpp> #include <boost/python.hpp>
compiled with the following command line:
cl /c /I "c:/Dev/boost_1_31_0" /I "$PYTHONDIR/include" /EHsc test.cpp
produces these errors:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
test.cpp
c:/Dev\boost_1_31_0\boost\mpl\less.hpp(39) : error C2760: syntax error : expected ',' not ';'
(repost) This is a compiler bug, triggered by the token sequence 'value' '<' when the compiler has seen a class template named 'value' anywhere, i.e. in any namespace, or even nested in a class. This has been fixed in CVS - just reverse the a < b expression in mpl/less.hpp, turning it into b > a. http://cvs.sourceforge.net/viewcvs.py/boost/boost/boost/mpl/less.hpp?r1=1.2&...
participants (3)
-
David Abrahams
-
Nat Goodspeed
-
Peter Dimov