boost-python

How to build a boost dependent project using regular makefiles?

爷,独闯天下 提交于 2019-12-01 00:37:50
问题 I'm working on a c++ project, and we recently needed to include a small part of boost in it. The boost part is really minimal (Boost::Python), thus, using bjam to build everything looks like an overkill (besides, everyone working on the project feels comfortable with make, and has no knowloedge of jam). I made quite some tests already, but I cant find a way to include the formerly mentioned library in my makefile and make the build succesful. All your help is deeply apreciated. :) 回答1: I had

boost-python: How do I provide a custom constructor wrapper function?

拜拜、爱过 提交于 2019-12-01 00:30:35
问题 I'm using boost-python to create python bindings for a C++ class named CppClass . When necessary, I can route calls to "normal" member functions through little wrapper functions that preprocess the arguments (e.g. extract C++ types from the python args), like so: class CppClass { public: CppClass(SpecialParameters p); void doSomething(int x, float y); }; using namespace boost::python; // For extract, tuple, init, class_, etc. class WrapperFuncs { public: static void doSomething(CppClass & c,

ImportError: /usr/lib/libboost_python.so.1.54.0: undefined symbol: PyClass_Type

半世苍凉 提交于 2019-11-30 20:54:09
I have code written in C++: #include <boost/python.hpp> char const* greet() { return "Yay!"; } BOOST_PYTHON_MODULE(libtest) { using namespace boost::python; def("greet", greet); } Now i want to import this dynamic library to python by: import libtest But I get: ImportError: /usr/lib/libboost_python.so.1.54.0: undefined symbol: PyClass_Type What should I do? My OS is Arch Linux. Ok, I have found solution for this problem. The simplest options is to compile by: g++ testing.cpp -I/usr/include/python3.3m -I/usr/include/boost -lboost_python3 -lpython3.3m -o testing.so -shared -fPIC Previously I

Build problems when adding `__str__` method to Boost Python C++ class

╄→尐↘猪︶ㄣ 提交于 2019-11-30 17:18:15
I have started to play around with boost python a bit and ran into a problem. I tried to expose a C++ class to python which posed no problems. But I can't seem to manage to implement the __str__ functionality for the class without getting build errors I don't understand. I'm using boost 1_42 prebuild by boostpro. I build the library using cmake and the vs2010 compiler. I have a very simple setup. The header-file (tutorial.h) looks like the following: #include <iostream> namespace TestBoostPython{ class TestClass { private: double m_x; public: TestClass(double x); double Get_x() const; void Set

Building/including Boost.Python in VS2013

跟風遠走 提交于 2019-11-30 16:57:09
问题 Can someone tell me if I'm doing anything wrong. I'm on Windows 7 using Visual Studio 2013 and I would like to be able to be able to setup a simple Boost.Python project. I don't know if I've made something wrong building boost or when including boost in my project. Error When I try to #include any boost python module, e.g. #include <boost/python/module.hpp> I get the following error in Visual Studio. 1>c:\boost_1_55_0\boost\python\detail\wrap_python.hpp(50): fatal error C1083: Cannot open

compile some code with boost.python by mingw in win7-64bit

大城市里の小女人 提交于 2019-11-30 16:34:37
I decided to make my program compatible with windows environment.But I have very little programming experience on windows.There are some errors need help. Environment: os: win7-64bit, ide: codeblocks12.11, python: Python 2.7.3 Windows X86-64 Installer (Windows AMD64 / Intel 64 / X86-64 binary [1] -- does not include source) compiler: mingw that come from codeblocks installation package. boost: boost1.52 I only copy and test this "hello" code that come from ".\boost_1_52_0\libs\python\example\tutorial" Code: #include <iostream> #include <boost/python/module.hpp> #include <boost/python/def.hpp>

does boost python support a function returning a vector, by ref or value?

痴心易碎 提交于 2019-11-30 16:29:25
I am new to python, I have looked at boost python, and it looks very impressive. However going through the introduction I can not find any examples where, vector of objects are returned as python list/tuples. i.e Take this example, I want to expose class X, Cont and all its functions. critical bit being return a vector of X's or strings to python class X {}; class Cont { ..... // how can this be exposed using boost python const std::vector<X>& const_ref_x_vec() const { return x_vec_;} std::vector<X> value_x_vec() const { return x_vec;} const std::vector<std::string>& const_ref_str_vec() const

does boost python support a function returning a vector, by ref or value?

人盡茶涼 提交于 2019-11-30 16:29:15
问题 I am new to python, I have looked at boost python, and it looks very impressive. However going through the introduction I can not find any examples where, vector of objects are returned as python list/tuples. i.e Take this example, I want to expose class X, Cont and all its functions. critical bit being return a vector of X's or strings to python class X {}; class Cont { ..... // how can this be exposed using boost python const std::vector<X>& const_ref_x_vec() const { return x_vec_;} std:

compile some code with boost.python by mingw in win7-64bit

廉价感情. 提交于 2019-11-30 16:14:15
问题 I decided to make my program compatible with windows environment.But I have very little programming experience on windows.There are some errors need help. Environment: os: win7-64bit, ide: codeblocks12.11, python: Python 2.7.3 Windows X86-64 Installer (Windows AMD64 / Intel 64 / X86-64 binary [1] -- does not include source) compiler: mingw that come from codeblocks installation package. boost: boost1.52 I only copy and test this "hello" code that come from ".\boost_1_52_0\libs\python\example

wrapping a list of structs with boost.python

北战南征 提交于 2019-11-30 15:55:13
问题 I have a C++ function that returns a list of structs. Inside the struct, there are more lists of structs. struct CameraInfo { CamName name; std::list<CamImageFormat> lImgFormats; std::list<CamControls> lCamControls; }; std::list<CameraInfo> getCameraInfo() { std::list<CameraInfo> lCamerasInfo; // fill lCamerasInfo return lCamerasInfo; } then for exporting it I was using: class_<CameraNode....> >("CameraNode", no_init) ... ... .def("listCameraInfo", make_function(&CameraNode::listCameraInfo))