加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xcode – Boost.Python – 即使lib文件已链接,也未定义符号错误

发布时间:2020-12-14 17:50:28 所属栏目:百科 来源:网络整理
导读:我正在测试Boost. Python并遇到了一些问题. 我设法完成了“Hello World”示例,没有出现故障(http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/index.html) – 所有编译完成后我都可以在Python中正确使用.so. 但是,只要我将类引入我
我正在测试Boost. Python并遇到了一些问题.

我设法完成了“Hello World”示例,没有出现故障(http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/index.html) – 所有编译完成后我都可以在Python中正确使用.so.

但是,只要我将类引入我的测试文件(http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/exposing.html),编译器就开始尖叫

Undefined symbols for architecture x86_64:
      "boost::python::objects::function_object(boost::python::objects::py_function const&,std::__1::pair<boost::python::detail::keyword const*,boost::python::detail::keyword const*> const&)",referenced from:
          boost::python::api::object boost::python::detail::make_function_aux<void (World::*)(std::__1::basic_string<char,std::__1::char_traits<char>,std::__1::allocator<char> >),boost::python::default_call_policies,boost::mpl::vector3<void,World&,std::__1::basic_string<char,std::__1::allocator<char> > >,mpl_::int_<0> >(void (World::*)(std::__1::basic_string<char,boost::python::default_call_policies const&,std::__1::allocator<char> > > const&,boost::python::detail::keyword const*> const&,mpl_::int_<0>) in SHLibPy.o
          boost::python::api::object boost::python::detail::make_function_aux<std::__1::basic_string<char,std::__1::allocator<char> > (World::*)(),boost::mpl::vector2<std::__1::basic_string<char,std::__1::allocator<char> >,World&>,mpl_::int_<0> >(std::__1::basic_string<char,World&> const&,mpl_::int_<0>) in SHLibPy.o
          boost::python::api::object boost::python::detail::make_function_aux<void (*)(_object*),boost::mpl::vector2<void,_object*>,mpl_::int_<0> >(void (*)(_object*),_object*> const&,mpl_::int_<0>) in SHLibPy.o
      "boost::python::objects::register_dynamic_id_aux(boost::python::type_info,std::__1::pair<void*,boost::python::type_info> (*)(void*))",referenced from:
          void boost::python::objects::register_dynamic_id<World>(World*) in SHLibPy.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

它似乎表明lib文件没有链接,但我已将它们包含在XCode中

我错过了什么吗?非常感谢!

解决方法

我发现了原因.事实证明我正在使用支持C 11的标准库.为了解决这个问题,我使用brew重建了boost如下

brew -v install --with-icu --build-from-source --with-c++11 boost

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读