接受std::string
输入的函数无法通过增强.pythongcc/5.2.0;gcc 4.8.3适用。
p、 我正在使用一个预先构建的libboost_Python.so.1.63. 你知道吗
C++代码
#include <boost/python.hpp>
#include <iostream>
using namespace boost::python;
void func(const std::string & hi)
{
std::cout<<hi<<std::endl;
}
BOOST_PYTHON_MODULE(example)
{
def("func", &func);
}
Python执行
>>> from example import *
>>> func("hi")
Boost.Python.ArgumentError: Python argument types in
example.func(str)
did not match C++ signature:
func(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >)
目前没有回答
相关问题 更多 >
编程相关推荐