ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved