iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了xcode – Boost.Python – 即使lib文件已链接,也未定义符号错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在测试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.bo
我正在测试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

大佬总结

以上是大佬教程为你收集整理的xcode – Boost.Python – 即使lib文件已链接,也未定义符号错误全部内容,希望文章能够帮你解决xcode – Boost.Python – 即使lib文件已链接,也未定义符号错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。