[C++-sig] Compile error when using exception_translation.hpp
by Ger van Diepen other posts by this author
Oct 12 2009 2:06AM messages near this date
Re: [C++-sig] Numpy ndarray as argument or return value using boost python
|
Re: [C++-sig] Compile error when using exception_translation.hpp
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
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@[...].org
http://mail.python.org/mailman/listinfo/cplusplus-sig
Thread:
Ger van Diepen
Ralf W. Grosse-Kunstleve
|