I'm trying to wrap a simple demo class with a function called "addTwoNumbers" with boost python. Here's the header file:
#ifndef DEMO_H_
#define DEMO_H_
#include <boost/function.hpp>
class Demo
{
public:
Demo() {}
virtual ~Demo() {}
typedef void (DemoCb) (int,int,int);
boost::function<DemoCb> onAddTwoNumbers;
int addTwoNumbers(int x, int y);
// Executes a callback within a thread not controlled by the caller.
void addTwoNumbersAsync(int x, int y, boost::function<DemoCb> callback);
};
#endif /* DEMO_H_ */
And here's the wrapping:
#include <boost/python.hpp>
#include "../demo.h"
using namespace boost::python;
// Create a python module using boost. The name 'demo' must match the name in the makefile
BOOST_PYTHON_MODULE(python_wrap_demo) {
// Wrapping the addTwoNumbers function:
class_<Demo>("Demo", init<>())
.def("addTwoNumbers", Demo::addTwoNumbers)
;
}
I got this to work for a similar function, which wasn't wrapped in a class. Why am I now getting this error?