[C++-sig] Compile error when using exception_translation.hpp
Ger van Diepen
diepen at astron.nl
Mon Oct 12 09:38:42 CEST 2009
When compiling the following code using gcc-4.3.2 and boost-1.37, I get
errors as listed at the end. It also fails for boost-1.40 and gcc-4.3.4.
It is solved when patching translate_exception.hpp by adding
# include <boost/type_traits/add_reference.hpp>
Is it a Boost-Python problem or do I do something wrong?
Of course, I can include that file in my own code, but that does not
seem the correct solution to me.
Thanks,
Ger van Diepen
#include <boost/translate_exception.hpp>
#include <stdexcept>
void translate_stdexcp (const std::exception& e)
{
PyErr_SetString(PyExc_RuntimeError, e.what());
}
//# Note that the most general exception must be registered first.
void register_convert_excp()
{
boost::python::register_exception_translator<std::exception>
(&translate_stdexcp);
}
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:34:
error: expected nested-name-specifier before ‘add_reference’
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:34:
error: expected ‘;’ before ‘<’ token
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:
In member function ‘bool
boost::python::detail::translate_exception<ExceptionType,
Translate>::operator()(const
boost::python::detail::exception_handler&,
const boost::function0<void>&, typename
boost::call_traits<Translate>::param_type) const’:
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:56:
error: expected type-specifier before ‘exception_cref’
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:56:
error: expected `)' before ‘e’
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:56:
error: expected `{' before ‘e’
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:56:
error: ‘e’ was not declared in this scope
/home/jds/Work/svn-usg/release/include/boost/python/detail/translate_exception.hpp:56:
error: expected `;' before ‘)’ token
More information about the Cplusplus-sig
mailing list