when i compile an iOS project with using the three part library, i got "Apple Mach-O linker Error"
Asked Answered
E

4

7

I've added a library named "*.a" from three part and added its header file in my XCode project. While I compile the project, there are many "Apple Mach-O linker Error". Here the error info:

"std::ios_base::failure::~failure()", referenced from:

  "std::_List_node_base::unhook()", referenced from:

  "std::string::find(char const*, unsigned long, unsigned long) const", referenced from:

  "std::ios_base::failure::failure(std::string const&)", referenced from:

  "std::_List_node_base::hook(std::_List_node_base*)", referenced from:

  "std::invalid_argument::invalid_argument(std::string const&)", referenced from:

  "std::runtime_error::runtime_error(std::string const&)", referenced from:

  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(unsigned long, char, std::allocator<char> const&)", referenced from:

  "std::string::assign(char const*, unsigned long)", referenced from:

  "std::istream::operator>>(int&)", referenced from:

  "vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >", referenced from:

  "vtable for std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >", referenced from:

  "std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)", referenced from:

  "vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >", referenced from:

  "std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:

  "std::ios_base::Init::Init()", referenced from:

  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from:

  "std::ostream& std::ostream::_M_insert<double>(double)", referenced from:

  "std::string::append(unsigned long, char)", referenced from:

  "std::string::_M_leak_hard()", referenced from:

  "std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from:

  "std::string::find(char, unsigned long) const", referenced from:

  "std::string::find_last_not_of(char const*, unsigned long, unsigned long) const", referenced from:

  "std::string::replace(unsigned long, unsigned long, char const*, unsigned long)", referenced from:

  "std::string::reserve(unsigned long)", referenced from:

  "std::string::_M_mutate(unsigned long, unsigned long, unsigned long)", referenced from:

  "VTT for std::basic_ifstream<char, std::char_traits<char> >", referenced from:

  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from:

  "non-virtual thunk to std::basic_istream<char, std::char_traits<char> >::~basic_istream()", referenced from:

  "std::string::_Rep::_S_terminal", referenced from:

  "std::string::_Rep::_S_max_size", referenced from:

  "std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&)", referenced from:

  "std::string::_M_replace_safe(unsigned long, unsigned long, char const*, unsigned long)", referenced from:

  "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::__throw_length_error(char const*)", referenced from:

  "std::string::append(char const*, unsigned long)", referenced from:

  "std::basic_istream<char, std::char_traits<char> >::~basic_istream()", referenced from:

  "std::string::compare(char const*) const", referenced from:

  "std::basic_filebuf<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)", referenced from:

  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)", referenced from:

  "std::basic_filebuf<char, std::char_traits<char> >::close()", referenced from:

  "std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::basic_istringstream(std::string const&, std::_Ios_Openmode)", referenced from:

  "std::ios_base::Init::~Init()", referenced from:

  "vtable for std::basic_streambuf<char, std::char_traits<char> >", referenced from:

  "std::ios_base::~ios_base()", referenced from:

  "std::_Rb_tree_increment(std::_Rb_tree_node_base const*)", referenced from:

  "std::ostream::operator<<(int)", referenced from:

  "std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from:

  "std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const", referenced from:

  "std::istream& std::istream::_M_extract<float>(float&)", referenced from:

  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:

  "std::string::append(std::string const&)", referenced from:

  "std::string::find_first_of(char const*, unsigned long, unsigned long) const", referenced from:

  "std::__throw_out_of_range(char const*)", referenced from:

  "std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream()", referenced from:

  "std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)", referenced from:

  "std::locale::~locale()", referenced from:

  "std::string::_Rep::_S_empty_rep_storage", referenced from:

  "std::string::find_first_not_of(char const*, unsigned long, unsigned long) const", referenced from:

  "std::string::assign(std::string const&)", referenced from:

  "std::basic_ifstream<char, std::char_traits<char> >::~basic_ifstream()", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any one help me to fix this issue. Thanks!

Electrokinetics answered 16/3, 2014 at 13:59 Comment(0)
T
6

Looks like the library uses C++. Try adding libstdc++ to your target.

Tedesco answered 16/3, 2014 at 14:3 Comment(3)
I've add libstdc++ to my target, but this does not make sense. I don't know how to fix this issue.Electrokinetics
Try to add libstdc++.6 insteadJaella
Ran into the same issue when trying to build with the Red Laser SDK from eBay. The instructions from their own READ ME doc didn't help but this link did. ThxAustria
A
2

Thanks it helped me to repair my project, during switching from SDK 6 to SDK 8 had the same errors.

With adding libstdc++6 i could solve my problem.

Acrospire answered 22/1, 2016 at 12:37 Comment(0)
N
1

Try changing the C++ Standard Library from Compiler Default to libstdc++ (GNU C++ standard library) in the Target --- > Build Settings --> C++ standard library

This solved my problem .

Nicholle answered 26/7, 2016 at 12:39 Comment(0)
Y
0

The answer from @Phillip Mills was great hint to solve many errors but instead of that to terminate all errors I changed C++ Standard Library settings under Apple LLVM 8.0 - Language - C++ to libstdc++ as shown in the screenshot. I have safely removed the libstdc++ library from the target.

Screenshot

Yearly answered 17/11, 2016 at 6:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.