问题:
做ios项目中用到1个第三库:shareSDK,需要因为新浪分享可能是是C++写的需要在buildsetting 中ohterlinker 中添加-ObjC 这时候会报错。
Undefined symbols for architecture i386: "std::string::_Rep::_M_destroy(std::allocatorconst&)", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::string::_Rep::_S_empty_rep_storage", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::string::append(char const*, unsigned long)", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::basic_string, std::allocator>::basic_string(char const*, std::allocatorconst&)", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::basic_string, std::allocator>::basic_string(std::string const&)", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::basic_string, std::allocator>::~basic_string()", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::basic_string, std::allocator>::~basic_string()", referenced from: SChartGL::Drawer::renderRenderData(SChartGL::RenderDataType, SChartGL::RenderData const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) "std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from: SChartGL::Drawer::endRender(SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) std::_Rb_tree> >, std::_Select1st> > >, std::less, std::allocator> > > >::_M_insert_unique(std::_Rb_tree_iterator> > >, std::pair> > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree> >, std::_Select1st> > >, std::less, std::allocator> > > >::_M_insert_unique(std::pair> > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::pairconst, std::map>, std::less, std::allocator> > > > >, std::_Select1stconst, std::map>, std::less, std::allocator> > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocatorconst, std::map>, std::less, std::allocator> > > > > > >::_M_insert_unique(std::_Rb_tree_iteratorconst, std::map>, std::less, std::allocator> > > > > >, std::pairconst, std::map>, std::less, std::allocator> > > > > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::pairconst, std::map>, std::less, std::allocator> > > > >, std::_Select1stconst, std::map>, std::less, std::allocator> > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocatorconst, std::map>, std::less, std::allocator> > > > > > >::_M_insert_unique(std::pairconst, std::map>, std::less, std::allocator> > > > > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::tr1::shared_ptr, std::_Identity>, SChartGL::VboSet::VboLessThan, std::allocator> >::_M_insert_unique(std::tr1::shared_ptrconst&) in ShinobiCharts(ShinobiCharts) "std::_Rb_tree_increment(std::_Rb_tree_node_base const*)", referenced from: SChartGL::Drawer::renderRenderData(std::map>, std::less, std::allocator> > > > const&, int*, SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) SChartGL::VboSet::bufferDirtyData() in ShinobiCharts(ShinobiCharts) SChartGL::VboSet::totalDataSize() const in ShinobiCharts(ShinobiCharts) "std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from: SChartGL::Drawer::endRender(SChartGL::AnimationManager*) in ShinobiCharts(ShinobiCharts) SChartGL::Drawer::updateRenderQueue(std::tr1::shared_ptr, SChartGLTranslation const*, bool) in ShinobiCharts(ShinobiCharts) SChartGL::Drawer::updateRenderQueue(std::tr1::shared_ptr, int, float, float, float, bool) in ShinobiCharts(ShinobiCharts) SChartGL::Drawer::addDirtyVbos(std::map, std::map>, std::less, std::allocator> > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocatorconst, std::map>, std::less, std::allocator> > > > > > >&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree> >, std::_Select1st> > >, std::less, std::allocator> > > >::_M_insert_unique(std::_Rb_tree_iterator> > >, std::pair> > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::pairconst, std::map>, std::less, std::allocator> > > > >, std::_Select1stconst, std::map>, std::less, std::allocator> > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocatorconst, std::map>, std::less, std::allocator> > > > > > >::_M_insert_unique(std::_Rb_tree_iteratorconst, std::map>, std::less, std::allocator> > > > > >, std::pairconst, std::map>, std::less, std::allocator> > > > > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::tr1::shared_ptr, std::_Identity>, SChartGL::VboSet::VboLessThan, std::allocator> >::erase(std::_Rb_tree_iterator>, std::_Rb_tree_iterator>) in ShinobiCharts(ShinobiCharts) ... "std::__throw_length_error(char const*)", referenced from: std::vector>::_M_insert_aux(__gnu_cxx::__normal_iterator> >, SChartGL::RenderData const&) in ShinobiCharts(ShinobiCharts) std::vector>::_M_insert_aux(__gnu_cxx::__normal_iterator> >, SChartGL::VboData* const&) in ShinobiCharts(ShinobiCharts) "std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from: std::_Rb_tree, std::tr1::shared_ptr, std::_Identity>, SChartGL::VboSet::VboLessThan, std::allocator> >::erase(std::_Rb_tree_iterator>, std::_Rb_tree_iterator>) in ShinobiCharts(ShinobiCharts) "std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from: std::_Rb_tree> >, std::_Select1st> > >, std::less, std::allocator> > > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair> > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::pairconst, std::map>, std::less, std::allocator> > > > >, std::_Select1stconst, std::map>, std::less, std::allocator> > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocatorconst, std::map>, std::less, std::allocator> > > > > > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pairconst, std::map>, std::less, std::allocator> > > > > const&) in ShinobiCharts(ShinobiCharts) std::_Rb_tree, std::tr1::shared_ptr, std::_Identity>, SChartGL::VboSet::VboLessThan, std::allocator> >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::tr1::shared_ptrconst&) in ShinobiCharts(ShinobiCharts)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决办法:
网上搜索了下,最终发现一帖子http://blog.csdn.net/dingyaolxl12060621/article/details/9233745
本来改下下:Targets->BuildSetting->C++ Standard Library的默认值Libc++(默认的编译器),为libstdc++就可以了,但怕以后项目在有其他问题,感觉还是用默认的好些。