Compilation error for Boost.Function 1.34.x fix with TR1 headers.

Hi all, I recently applied the Boost.Function critical bug fix (Dec 17) to my boost 1.34.1 library and I came up against a compilation error. However, I found that if I removed the boost/tr1/tr1 include path when building then the fixed library would compile correctly. Has anyone got the fix to work with the TR1 include paths? I haven't see any other reports of problems with it. I'm using gcc 3.3.5. The first compile error is a suspicious BOOST_FUNCTION_NUM_ARGS redefinition by the TR1 headers. The compile output was as follows: C++ build/CommandLineOptions.o In file included from release/boost-1_34_1/boost/preprocessor/iteration/detail/iter/forward1.hpp:47, from release/boost-1_34_1/boost/function.hpp:62, from release/boost-1_34_1/boost/tr1/functional.hpp:99, from release/boost-1_34_1/boost/tr1/tr1/functional:27, from release/boost-1_34_1/boost/function/function_base.hpp:18, from release/boost-1_34_1/boost/function/detail/prologue.hpp:16, from release/boost-1_34_1/boost/function/function_template.hpp:12, from release/boost-1_34_1/boost/function/detail/maybe_include.hpp:18, from release/boost-1_34_1/boost/function/function1.hpp:11, from release/boost-1_34_1/boost/program_options/value_semantic.hpp:13, from release/boost-1_34_1/boost/program_options/options_description.hpp:13, from release/boost-1_34_1/boost/program_options.hpp:13, from src/CommandLineOptions.cpp:26: release/boost-1_34_1/boost/function/detail/function_iterate.hpp:13:1: "BOOST_FUNCTION_NUM_ARGS" redefined ******** note first error here ******* In file included from release/boost-1_34_1/boost/program_options/value_semantic.hpp:13, from release/boost-1_34_1/boost/program_options/options_description.hpp:13, from release/boost-1_34_1/boost/program_options.hpp:13, from src/CommandLineOptions.cpp:26: release/boost-1_34_1/boost/function/function1.hpp:10:1: this is the location of the previous definition In file included from release/boost-1_34_1/boost/function/detail/maybe_include.hpp:13, from release/boost-1_34_1/boost/function/detail/function_iterate.hpp:14, from release/boost-1_34_1/boost/preprocessor/iteration/detail/iter/forward1.hpp:47, from release/boost-1_34_1/boost/function.hpp:62, from release/boost-1_34_1/boost/tr1/functional.hpp:99, from release/boost-1_34_1/boost/tr1/tr1/functional:27, from release/boost-1_34_1/boost/function/function_base.hpp:18, from release/boost-1_34_1/boost/function/detail/prologue.hpp:16, from release/boost-1_34_1/boost/function/function_template.hpp:12, from release/boost-1_34_1/boost/function/detail/maybe_include.hpp:18, from release/boost-1_34_1/boost/function/function1.hpp:11, from release/boost-1_34_1/boost/program_options/value_semantic.hpp:13, from release/boost-1_34_1/boost/program_options/options_description.hpp:13, from release/boost-1_34_1/boost/program_options.hpp:13, from src/lCommandLineOptions.cpp:26: release/boost-1_34_1/boost/function/function_template.hpp:98: error: variable declaration is not allowed here release/boost-1_34_1/boost/function/function_template.hpp:98: error: syntax error before `{' token .... and then a bunch more errors before it gives up. If anyone else has got this scenario to work then I'll know it must be something screwy in our setup. Cheers, Robert.

Robert Fairlie-Cuninghame wrote:
Hi all,
I recently applied the Boost.Function critical bug fix (Dec 17) to my boost 1.34.1 library and I came up against a compilation error. However, I found that if I removed the boost/tr1/tr1 include path when building then the fixed library would compile correctly.
Has anyone got the fix to work with the TR1 include paths? I haven't see any other reports of problems with it.
I'm using gcc 3.3.5. The first compile error is a suspicious BOOST_FUNCTION_NUM_ARGS redefinition by the TR1 headers. The compile output was as follows:
If you look at the error trace below you'll see that both definitions are inside Boost.Function: TR1 doesn't mess around with that. Other than that, the only suggestion I have is to use the 1.35 release branch from SVN: we know our regression tests are passing with that combination of components. Unless someone who understands what Boost.Function is doing can comment? HTH, John.

John Maddock wrote:
I'm using gcc 3.3.5. The first compile error is a suspicious BOOST_FUNCTION_NUM_ARGS redefinition by the TR1 headers. The compile output was as follows:
If you look at the error trace below you'll see that both definitions are inside Boost.Function: TR1 doesn't mess around with that.
Hi John, Thanks for the reply. I did check that both boost/function/function1.hpp and boost/function/detail/function_iterate.hpp do indeed define BOOST_FUNCTION_NUM_ARGS (without #ifndef or #undef). I did also note that the new/fixed version of boost/function/function_base.hpp includes the <functional> header (where the old version did not) and of course that's where the new TR1 function classes reside when TR1 is included. Robert.
participants (2)
-
John Maddock
-
Robert Fairlie-Cuninghame