- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在尝试将我的 C++ 类“Car”转换为 Python 模块时,我正在努力解决这个问题并遇到大量 boost 错误
来自Car.h的代码
#ifndef Carproj_CAR_H
#define Carproj_CAR_H
#include <string>
class Car {
public:
Car(std::string & name, int & speed);
void drive();
void increaseSpeed();
private:
std::string m_name;
int m_speed;
};
Code from Car.cpp
#include "Car.h"
#include <string>
#include <iostream>
#include <boost/python.hpp>
using namespace boost::python;
Car::Car(std::string & name, int & speed) {
m_name = name;
m_speed = speed;
}
void Car::drive() {
std::cout << "Driving" << std::endl;
}
void Car::increaseSpeed() {
m_speed+=30;
}
BOOST_PYTHON_MODULE(Car)
{
class_<Car>("Car",init<std::string, int>())
.def("drive",&Car::drive).def("increaseSpeed",&Car::increaseSpeed);
}
接收错误 - 整个消息 :)
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:57:0,
from /usr/include/boost/python/object/value_holder.hpp:50,
from /usr/include/boost/python/object/class_metadata.hpp:11,
from /usr/include/boost/python/class.hpp:23,
from /usr/include/boost/python.hpp:18,
from /home/damian/CLionProjects/Carproj/Car.cpp:8:
/usr/include/boost/python/object/value_holder.hpp: In instantiation of ‘boost::python::objects::value_holder<Value>::value_holder(PyObject*, A0, A1) [with A0 = boost::python::objects::reference_to_value<std::__cxx11::basic_string<char> >; A1 = int; Value = Car; PyObject = _object]’:
/usr/include/boost/python/object/make_holder.hpp:94:17: required from ‘static void boost::python::objects::make_holder<2>::apply<Holder, ArgList>::execute(PyObject*, boost::python::objects::make_holder<2>::apply<Holder, ArgList>::t0, boost::python::objects::make_holder<2>::apply<Holder, ArgList>::t1) [with Holder = boost::python::objects::value_holder<Car>; ArgList = boost::mpl::vector2<std::__cxx11::basic_string<char>, int>; PyObject = _object; boost::python::objects::make_holder<2>::apply<Holder, ArgList>::t0 = std::__cxx11::basic_string<char>; boost::python::objects::make_holder<2>::apply<Holder, ArgList>::t1 = int]’
/usr/include/boost/python/detail/make_keyword_range_fn.hpp:63:47: required from ‘boost::python::api::object boost::python::detail::make_keyword_range_constructor(const CallPolicies&, const keyword_range&, Holder*, ArgList*, Arity*) [with ArgList = boost::mpl::vector2<std::__cxx11::basic_string<char>, int>; Arity = boost::mpl::size<boost::mpl::vector2<std::__cxx11::basic_string<char>, int> >; Holder = boost::python::objects::value_holder<Car>; CallPolicies = boost::python::default_call_policies; boost::python::detail::keyword_range = std::pair<const boost::python::detail::keyword*, const boost::python::detail::keyword*>]’
/usr/include/boost/python/init.hpp:332:66: required from ‘void boost::python::detail::def_init_aux(ClassT&, const Signature&, NArgs, const CallPoliciesT&, const char*, const keyword_range&) [with ClassT = boost::python::class_<Car>; CallPoliciesT = boost::python::default_call_policies; Signature = boost::mpl::vector2<std::__cxx11::basic_string<char>, int>; NArgs = boost::mpl::size<boost::mpl::vector2<std::__cxx11::basic_string<char>, int> >; boost::python::detail::keyword_range = std::pair<const boost::python::detail::keyword*, const boost::python::detail::keyword*>]’
/usr/include/boost/python/init.hpp:399:31: required from ‘static void boost::python::detail::define_class_init_helper<0>::apply(ClassT&, const CallPoliciesT&, const Signature&, NArgs, const char*, const keyword_range&) [with ClassT = boost::python::class_<Car>; CallPoliciesT = boost::python::default_call_policies; Signature = boost::mpl::vector2<std::__cxx11::basic_string<char>, int>; NArgs = boost::mpl::size<boost::mpl::vector2<std::__cxx11::basic_string<char>, int> >; boost::python::detail::keyword_range = std::pair<const boost::python::detail::keyword*, const boost::python::detail::keyword*>]’
/usr/include/boost/python/init.hpp:171:67: required from ‘void boost::python::init_base<DerivedT>::visit(classT&) const [with classT = boost::python::class_<Car>; DerivedT = boost::python::init<std::__cxx11::basic_string<char>, int>]’
/usr/include/boost/python/def_visitor.hpp:31:9: required from ‘static void boost::python::def_visitor_access::visit(const V&, classT&) [with V = boost::python::def_visitor<boost::python::init<std::__cxx11::basic_string<char>, int> >; classT = boost::python::class_<Car>]’
/usr/include/boost/python/def_visitor.hpp:67:34: required from ‘void boost::python::def_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<Car>; DerivedVisitor = boost::python::init<std::__cxx11::basic_string<char>, int>]’
/usr/include/boost/python/class.hpp:226:9: required from ‘boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::def(const boost::python::def_visitor<Derived>&) [with Derived = boost::python::init<std::__cxx11::basic_string<char>, int>; W = Car; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified; boost::python::class_<T, X1, X2, X3>::self = boost::python::class_<Car>]’
/usr/include/boost/python/class.hpp:502:9: required from ‘void boost::python::class_<T, X1, X2, X3>::initialize(const DefVisitor&) [with DefVisitor = boost::python::init_base<boost::python::init<std::__cxx11::basic_string<char>, int> >; W = Car; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’
/usr/include/boost/python/class.hpp:209:9: required from ‘boost::python::class_<T, X1, X2, X3>::class_(const char*, const boost::python::init_base<DerivedT>&) [with DerivedT = boost::python::init<std::__cxx11::basic_string<char>, int>; W = Car; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’
/home/damian/CLionProjects/Carproj/Car.cpp:31:57: required from here
/usr/include/boost/python/object/value_holder.hpp:137:13: error: binding ‘const std::__cxx11::basic_string<char>’ to reference of type ‘std::__cxx11::string& {aka std::__cxx11::basic_string<char>&}’ discards qualifiers
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil)
^
/home/damian/CLionProjects/Carproj/Car.cpp:14:1: note: initializing argument 1 of ‘Car::Car(std::__cxx11::string&, int&)’
Car::Car(std::string & name, int & speed) {
^
CMakeFiles/untitled1.dir/build.make:86: recipe for target 'CMakeFiles/untitled1.dir/Car.cpp.o' failed
make[3]: *** [CMakeFiles/untitled1.dir/Car.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/untitled1.dir/all' failed
make[2]: *** [CMakeFiles/untitled1.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/untitled1.dir/rule' failed
make[1]: *** [CMakeFiles/untitled1.dir/rule] Error 2
Makefile:118: recipe for target 'untitled1' failed
make: *** [untitled1] Error 2
使用 cmake --build/home/damian/CLionProjects/Carproj/cmake-build-debug --target untitled1 -- -j 2 进行构建
非常感谢任何帮助
----新----
根据 WinClouds 的建议,又出现了新的错误,我很困惑:(
Scanning dependencies of target untitled1
[ 33%] Building CXX object CMakeFiles/untitled1.dir/Car.cpp.o
[ 66%] Linking CXX executable untitled1
CMakeFiles/untitled1.dir/Car.cpp.o: In function `initCar':
/home/damian/CLionProjects/Carproj/Car.cpp:29: undefined reference to `boost::python::detail::init_module(char const*, void (*)())'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::type_info::name() const':
/usr/include/boost/python/type_id.hpp:165: undefined reference to `boost::python::detail::gcc_demangle(char const*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::detail::none()':
/usr/include/boost/python/detail/none.hpp:16: undefined reference to `_Py_NoneStruct'
/usr/include/boost/python/detail/none.hpp:16: undefined reference to `_Py_NoneStruct'
/usr/include/boost/python/detail/none.hpp:16: undefined reference to `_Py_NoneStruct'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::api::object::object()':
/usr/include/boost/python/object_core.hpp:504: undefined reference to `_Py_NoneStruct'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `_object* boost::python::expect_non_null<_object>(_object*)':
/usr/include/boost/python/errors.hpp:45: undefined reference to `boost::python::throw_error_already_set()'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::class_<Car, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_<boost::python::init<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> >(char const*, boost::python::init_base<boost::python::init<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> > const&)':
/usr/include/boost/python/class.hpp:207: undefined reference to `boost::python::objects::class_base::class_base(char const*, unsigned long, boost::python::type_info const*, char const*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `void boost::python::class_<Car, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::initialize<boost::python::init_base<boost::python::init<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> > >(boost::python::init_base<boost::python::init<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> > const&)':
/usr/include/boost/python/class.hpp:500: undefined reference to `boost::python::objects::class_base::set_instance_size(unsigned long)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `void boost::python::class_<Car, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<Car, void (Car::*)(), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >(Car*, char const*, void (Car::*)(), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...)':
/usr/include/boost/python/class.hpp:537: undefined reference to `boost::python::objects::add_to_namespace(boost::python::api::object const&, char const*, boost::python::api::object const&, char const*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::api::object boost::python::detail::make_function_aux<void (Car::*)(), boost::python::default_call_policies, boost::mpl::vector2<void, Car&>, mpl_::int_<0> >(void (Car::*)(), boost::python::default_call_policies const&, boost::mpl::vector2<void, Car&> const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&, mpl_::int_<0>)':
/usr/include/boost/python/make_function.hpp:62: undefined reference to `boost::python::objects::function_object(boost::python::objects::py_function const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `void boost::python::objects::class_metadata<Car, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::maybe_register_class_to_python<Car>(Car*, mpl_::bool_<false>)':
/usr/include/boost/python/object/class_metadata.hpp:275: undefined reference to `boost::python::objects::copy_class_object(boost::python::type_info const&, boost::python::type_info const&)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::py_function_impl_base::py_function_impl_base()':
/usr/include/boost/python/object/py_function.hpp:20: undefined reference to `vtable for boost::python::objects::py_function_impl_base'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::shared_ptr_from_python<Car>::shared_ptr_from_python()':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:25: undefined reference to `boost::python::converter::registry::insert(void* (*)(_object*), void (*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*), boost::python::type_info, _typeobject const* (*)())'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `void boost::python::objects::register_dynamic_id<Car>(Car*)':
/usr/include/boost/python/object/inheritance.hpp:73: undefined reference to `boost::python::objects::register_dynamic_id_aux(boost::python::type_info, std::pair<void*, boost::python::type_info> (*)(void*))'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::to_python_converter<Car, boost::python::objects::class_cref_wrapper<Car, boost::python::objects::make_instance<Car, boost::python::objects::value_holder<Car> > >, true>::to_python_converter()':
/usr/include/boost/python/to_python_converter.hpp:87: undefined reference to `boost::python::converter::registry::insert(_object* (*)(void const*), boost::python::type_info, _typeobject const* (*)())'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::shared_ptr_from_python<Car>::convertible(_object*)':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:35: undefined reference to `_Py_NoneStruct'
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:38: undefined reference to `boost::python::converter::get_lvalue_from_python(_object*, boost::python::converter::registration const&)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::shared_ptr_from_python<Car>::construct(_object*, boost::python::converter::rvalue_from_python_stage1_data*)':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:50: undefined reference to `boost::python::converter::shared_ptr_deleter::shared_ptr_deleter(boost::python::handle<_object>)'
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:50: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:58: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::expected_from_python_type_direct<Car>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:104: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::shared_ptr<void>::shared_ptr<void, boost::python::converter::shared_ptr_deleter>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/boost/smart_ptr/shared_ptr.hpp:358: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/include/boost/smart_ptr/shared_ptr.hpp:358: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::registration const& boost::python::converter::detail::registry_lookup2<Car const volatile>(Car const volatile& (*)())':
/usr/include/boost/python/converter/registered.hpp:87: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::detail::shared_count::shared_count<void*, boost::python::converter::shared_ptr_deleter>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/boost/smart_ptr/detail/shared_count.hpp:171: undefined reference to `boost::python::converter::shared_ptr_deleter::operator()(void const*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `_object* boost::python::objects::make_instance_impl<Car, boost::python::objects::value_holder<Car>, boost::python::objects::make_instance<Car, boost::python::objects::value_holder<Car> > >::execute<boost::reference_wrapper<Car const> const>(boost::reference_wrapper<Car const> const&)':
/usr/include/boost/python/object/make_instance.hpp:45: undefined reference to `boost::python::instance_holder::install(_object*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::make_holder<2>::apply<boost::python::objects::value_holder<Car>, boost::mpl::vector2<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >::execute(_object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)':
/usr/include/boost/python/object/make_holder.hpp:92: undefined reference to `boost::python::instance_holder::allocate(_object*, unsigned long, unsigned long)'
/usr/include/boost/python/object/make_holder.hpp:94: undefined reference to `boost::python::instance_holder::install(_object*)'
/usr/include/boost/python/object/make_holder.hpp:98: undefined reference to `boost::python::instance_holder::deallocate(_object*, void*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `_typeobject* boost::python::objects::make_instance<Car, boost::python::objects::value_holder<Car> >::get_class_object<boost::reference_wrapper<Car const> const>(boost::reference_wrapper<Car const> const&)':
/usr/include/boost/python/object/make_instance.hpp:66: undefined reference to `boost::python::converter::registration::get_class_object() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::value_holder<Car>::value_holder<boost::python::objects::reference_to_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, int>(_object*, boost::python::objects::reference_to_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, int)':
/usr/include/boost/python/object/value_holder.hpp:137: undefined
/usr/include/boost/python/object_core.hpp:213: undefined reference to `boost::python::objects::add_to_namespace(boost::python::api::object const&, char const*, boost::python::api::object const&, char const*)'
CMakeFiles/untitled1.dir/Car.cpp.o:(.rodata._ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiENS0_21default_call_policiesENS_3mpl7vector4IvS6_SC_iEEEEEE[_ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiENS0_21default_call_policiesENS_3mpl7vector4IvS6_SC_iEEEEEE]+0x30): undefined reference to `boost::python::objects::py_function_impl_base::max_arity() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(_object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int), boost::python::default_call_policies, boost::mpl::vector4<void, _object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > >::~caller_py_function_impl()':
/usr/include/boost/python/object/py_function.hpp:30: undefined reference to `boost::python::objects::py_function_impl_base::~py_function_impl_base()'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::detail::sp_counted_impl_pd<void*, boost::python::converter::shared_ptr_deleter>::~sp_counted_impl_pd()':
/usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:127: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
CMakeFiles/untitled1.dir/Car.cpp.o:(.rodata._ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM3CarFvvENS0_21default_call_policiesENS_3mpl7vector2IvRS5_EEEEEE[_ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM3CarFvvENS0_21default_call_policiesENS_3mpl7vector2IvRS5_EEEEEE]+0x30): undefined reference to `boost::python::objects::py_function_impl_base::max_arity() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (Car::*)(), boost::python::default_call_policies, boost::mpl::vector2<void, Car&> > >::~caller_py_function_impl()':
/usr/include/boost/python/object/py_function.hpp:30: undefined reference to `boost::python::objects::py_function_impl_base::~py_function_impl_base()'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::value_holder<Car>::~value_holder()':
/usr/include/boost/python/object/value_holder.hpp:43: undefined reference to `boost::python::instance_holder::~instance_holder()'
CMakeFiles/untitled1.dir/Car.cpp.o:(.rodata._ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiENS0_21default_call_policiesENS_3mpl7vector4IvS6_SC_iEEEEEE[_ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiENS0_21default_call_policiesENS_3mpl7vector4IvS6_SC_iEEEEEE]+0x10): undefined reference to `typeinfo for boost::python::objects::py_function_impl_base'
CMakeFiles/untitled1.dir/Car.cpp.o:(.rodata._ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM3CarFvvENS0_21default_call_policiesENS_3mpl7vector2IvRS5_EEEEEE[_ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM3CarFvvENS0_21default_call_policiesENS_3mpl7vector2IvRS5_EEEEEE]+0x10): undefined reference to `typeinfo for boost::python::objects::py_function_impl_base'
CMakeFiles/untitled1.dir/Car.cpp.o:(.rodata._ZTIN5boost6python7objects12value_holderI3CarEE[_ZTIN5boost6python7objects12value_holderI3CarEE]+0x10): undefined reference to `typeinfo for boost::python::instance_holder'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::detail::sp_counted_impl_pd<void*, boost::python::converter::shared_ptr_deleter>::dispose()':
/usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:153: undefined reference to `boost::python::converter::shared_ptr_deleter::operator()(void const*)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::objects::value_holder<Car>::holds(boost::python::type_info, bool)':
/usr/include/boost/python/object/value_holder.hpp:96: undefined reference to `boost::python::objects::find_static_type(void*, boost::python::type_info, boost::python::type_info)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::arg_rvalue_from_python<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::arg_rvalue_from_python(_object*)':
/usr/include/boost/python/converter/arg_from_python.hpp:299: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::arg_rvalue_from_python<int>::arg_rvalue_from_python(_object*)':
/usr/include/boost/python/converter/arg_from_python.hpp:299: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::expected_pytype_for_arg<void>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/include/boost/python/converter/pytype_function.hpp:69: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::expected_pytype_for_arg<_object*>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/include/boost/python/converter/pytype_function.hpp:69: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::expected_pytype_for_arg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/include/boost/python/converter/pytype_function.hpp:69: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::expected_pytype_for_arg<int>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/include/boost/python/converter/pytype_function.hpp:69: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::reference_arg_from_python<Car&>::reference_arg_from_python(_object*)':
/usr/include/boost/python/converter/arg_from_python.hpp:283: undefined reference to `boost::python::converter::get_lvalue_from_python(_object*, boost::python::converter::registration const&)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::expected_pytype_for_arg<Car&>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/include/boost/python/converter/pytype_function.hpp:69: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::registration const& boost::python::converter::detail::registry_lookup2<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const volatile>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const volatile& (*)())':
/usr/include/boost/python/converter/registered.hpp:87: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
CMakeFiles/untitled1.dir/Car.cpp.o: In function `boost::python::converter::registration const& boost::python::converter::detail::registry_lookup2<int const volatile>(int const volatile& (*)())':
/usr/include/boost/python/converter/registered.hpp:87: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
collect2: error: ld returned 1 exit status
CMakeFiles/untitled1.dir/build.make:120: recipe for target 'untitled1' failed
make[3]: *** [untitled1] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/untitled1.dir/all' failed
make[2]: *** [CMakeFiles/untitled1.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/untitled1.dir/rule' failed
make[1]: *** [CMakeFiles/untitled1.dir/rule] Error 2
Makefile:118: recipe for target 'untitled1' failed
make: *** [untitled1] Error 2
如果有人知道任何 Material ,因为我是 Boost Python 的新手,这将很有用,因为这种错误消息流令人难以置信
达米安
最佳答案
Class Car 的构造函数参数需要一个非常量引用,所以它只接受左值。
但是Python导出的类模板是一个临时值,是一个右值,不能作为构造函数的参数。
因此,您可以将 Car 的构造函数参数的参数更改为常量引用。像这样:
Car(const std::string & name, const int & speed);
关于python - 在遵循 boost python 的逐步指导时引发了 boost python 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49896643/
SQLite、Content provider 和 Shared Preference 之间的所有已知区别。 但我想知道什么时候需要根据情况使用 SQLite 或 Content Provider 或
警告:我正在使用一个我无法完全控制的后端,所以我正在努力解决 Backbone 中的一些注意事项,这些注意事项可能在其他地方更好地解决......不幸的是,我别无选择,只能在这里处理它们! 所以,我的
我一整天都在挣扎。我的预输入搜索表达式与远程 json 数据完美配合。但是当我尝试使用相同的 json 数据作为预取数据时,建议为空。点击第一个标志后,我收到预定义消息“无法找到任何内容...”,结果
我正在制作一个模拟 NHL 选秀彩票的程序,其中屏幕右侧应该有一个 JTextField,并且在左侧绘制弹跳的选秀球。我创建了一个名为 Ball 的类,它实现了 Runnable,并在我的主 Draf
这个问题已经有答案了: How can I calculate a time span in Java and format the output? (18 个回答) 已关闭 9 年前。 这是我的代码
我有一个 ASP.NET Web API 应用程序在我的本地 IIS 实例上运行。 Web 应用程序配置有 CORS。我调用的 Web API 方法类似于: [POST("/API/{foo}/{ba
我将用户输入的时间和日期作为: DatePicker dp = (DatePicker) findViewById(R.id.datePicker); TimePicker tp = (TimePic
放宽“邻居”的标准是否足够,或者是否有其他标准行动可以采取? 最佳答案 如果所有相邻解决方案都是 Tabu,则听起来您的 Tabu 列表的大小太长或您的释放策略太严格。一个好的 Tabu 列表长度是
我正在阅读来自 cppreference 的代码示例: #include #include #include #include template void print_queue(T& q)
我快疯了,我试图理解工具提示的行为,但没有成功。 1. 第一个问题是当我尝试通过插件(按钮 1)在点击事件中使用它时 -> 如果您转到 Fiddle,您会在“内容”内看到该函数' 每次点击都会调用该属
我在功能组件中有以下代码: const [ folder, setFolder ] = useState([]); const folderData = useContext(FolderContex
我在使用预签名网址和 AFNetworking 3.0 从 S3 获取图像时遇到问题。我可以使用 NSMutableURLRequest 和 NSURLSession 获取图像,但是当我使用 AFHT
我正在使用 Oracle ojdbc 12 和 Java 8 处理 Oracle UCP 管理器的问题。当 UCP 池启动失败时,我希望关闭它创建的连接。 当池初始化期间遇到 ORA-02391:超过
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 9 年前。 Improve
引用这个plunker: https://plnkr.co/edit/GWsbdDWVvBYNMqyxzlLY?p=preview 我在 styles.css 文件和 src/app.ts 文件中指定
为什么我的条形这么细?我尝试将宽度设置为 1,它们变得非常厚。我不知道还能尝试什么。默认厚度为 0.8,这是应该的样子吗? import matplotlib.pyplot as plt import
当我编写时,查询按预期执行: SELECT id, day2.count - day1.count AS diff FROM day1 NATURAL JOIN day2; 但我真正想要的是右连接。当
我有以下时间数据: 0 08/01/16 13:07:46,335437 1 18/02/16 08:40:40,565575 2 14/01/16 22:2
一些背景知识 -我的 NodeJS 服务器在端口 3001 上运行,我的 React 应用程序在端口 3000 上运行。我在 React 应用程序 package.json 中设置了一个代理来代理对端
我面临着一个愚蠢的问题。我试图在我的 Angular 应用程序中延迟加载我的图像,我已经尝试过这个2: 但是他们都设置了 src attr 而不是 data-src,我在这里遗漏了什么吗?保留 d
我是一名优秀的程序员,十分优秀!