问题:
做ios项目中用到1个第三库:ShinobiCharts,今天在做zip数据压缩时用到开源的代码库:ZipArchive;
发现项目引入ZipArchive后会错误;但新创建项目引入后没有问题,最终找到和ShinobiCharts 有冲突;
大概是ZipArchive用的是c++写的 ,ShinobiCharts用到了c++的库,导致冲突的;
错误如下:
Undefined symbols for architecture i386:
"std::string::_Rep::_M_destroy(std::allocator const&)", 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::allocator const&)", 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::pair const, std::map >, std::less, std::allocator > > > > >, std::_Select1st const, std::map >, std::less, std::allocator > > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocator const, std::map >, std::less, std::allocator > > > > > > >::_M_insert_unique(std::_Rb_tree_iterator const, std::map >, std::less, std::allocator > > > > > >, std::pair const, std::map >, std::less, std::allocator > > > > > const&) in ShinobiCharts(ShinobiCharts)
std::_Rb_tree, std::pair const, std::map >, std::less, std::allocator > > > > >, std::_Select1st const, std::map >, std::less, std::allocator > > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocator const, std::map >, std::less, std::allocator > > > > > > >::_M_insert_unique(std::pair const, 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_ptr const&) 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::allocator const, 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::pair const, std::map >, std::less, std::allocator > > > > >, std::_Select1st const, std::map >, std::less, std::allocator > > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocator const, std::map >, std::less, std::allocator > > > > > > >::_M_insert_unique(std::_Rb_tree_iterator const, std::map >, std::less, std::allocator > > > > > >, std::pair const, 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::pair const, std::map >, std::less, std::allocator > > > > >, std::_Select1st const, std::map >, std::less, std::allocator > > > > > >, SChartGL::Drawer::SeriesHandleCompare, std::allocator const, std::map >, std::less, std::allocator > > > > > > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair const, 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_ptr const&) 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++就可以了,但怕以后项目在有其他问题,感觉还是用默认的好些,就把ZipArchive.mm 改为ZipArchive.m 就ok了