Python无法创建“Boost.Python.class”实例
我试图在Boost.Python中找到答案,但我无法包装任何类。我可以创建保留函数的.pyd,但当我使用类创建它时,我得到了以下结果:Python无法创建“Boost.Python.class”实例,python,c++,boost,Python,C++,Boost,我试图在Boost.Python中找到答案,但我无法包装任何类。我可以创建保留函数的.pyd,但当我使用类创建它时,我得到了以下结果: TypeError: cannot create 'Boost.Python.class' instances. 所以我有3个文件:myPoint.h、myPoint.cpp、classPoint.cpp。我做错了什么 myPoint.h myPoint.cpp classPoint.cpp struct myPoint { int x, y;
TypeError: cannot create 'Boost.Python.class' instances.
所以我有3个文件:myPoint.h、myPoint.cpp、classPoint.cpp。我做错了什么
myPoint.h
myPoint.cpp
classPoint.cpp
struct myPoint {
int x, y;
myPoint(int _x, int _y);
};
#include "myPoint.h"
myPoint::myPoint(int _x, int _y): x(_x), y(_y) {}
#define BOOST_PYTHON_STATIC_LIB
#include <boost\python.hpp>
#include "myPoint.h"
BOOST_PYTHON_MODULE(classPoint) {
using namespace boost::python;
class_<myPoint>("myPoint", init<int, int>());
}