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

前端之家收集整理的这篇文章主要介绍了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.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相关文章