<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>
<div style="font-family: Calibri,sans-serif; font-size: 11pt;">symbols for libc++ mostly start with std::__1:: which is a result of using inline namespaces. It seems you are getting libstdc++ headers instead for some of your code.<br>
</div>
</div>
<hr>
<span style="font-family: Tahoma,sans-serif; font-size: 10pt; font-weight: bold;">From:
</span><span style="font-family: Tahoma,sans-serif; font-size: 10pt;">Christian Parpart</span><br>
<span style="font-family: Tahoma,sans-serif; font-size: 10pt; font-weight: bold;">Sent:
</span><span style="font-family: Tahoma,sans-serif; font-size: 10pt;">2/19/2013 9:24 AM</span><br>
<span style="font-family: Tahoma,sans-serif; font-size: 10pt; font-weight: bold;">To:
</span><span style="font-family: Tahoma,sans-serif; font-size: 10pt;">cfe-users@cs.uiuc.edu</span><br>
<span style="font-family: Tahoma,sans-serif; font-size: 10pt; font-weight: bold;">Subject:
</span><span style="font-family: Tahoma,sans-serif; font-size: 10pt;">[cfe-users] undefined references to libc++ inlines when linking executable</span><br>
<br>
<div>
<div>Hey all,</div>
<div><br>
</div>
<div>I am about to ensure that my C++11 code is also nicely compiling </div>
<div>with Clang and libc++ (both on trunk, older don't even come that far).</div>
<div><br>
</div>
<div>Now, everything compiles fine, but I cannot link, due to some really</div>
<div>strange errors (as you see below). lt complains about undefined references</div>
<div>to well defined methods. I've checked it, they do exist, but it still can't find them.</div>
<div><br>
</div>
<div>The thing now is, doing the little test works just fine, but the actual code</div>
<div>is a little more complex, splitted up into 3 shared libraries, a few plugins, and an executable.</div>
<div>And that executable does not link because of the following undefined symbols....</div>
<div><br>
</div>
<div><br>
</div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `vtable for std::basic_streambuf<char, std::char_traits<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::push_back(char)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::assign(std::string const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `vtable for std::basic_ifstream<char, std::char_traits<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::locale::~locale()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(unsigned long, char, std::allocator<char> const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char>
>&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::compare(char const*) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `vtable for std::basic_filebuf<char, std::char_traits<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::istream& std::istream::_M_extract<unsigned int>(unsigned int&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::compare(std::string const&) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::ws<char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::assign(char const*, unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::find(char const*, unsigned long, unsigned long) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&,
char const*, long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::__throw_out_of_range(char const*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::copy(char*, unsigned long, unsigned long) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base const*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::basic_istringstream(std::string const&, std::_Ios_Openmode)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::clear()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::append(std::string const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `VTT for std::basic_ifstream<char, std::char_traits<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::ios_base::ios_base()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::operator=(std::string const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::_M_leak_hard()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::__basic_file<char>::~__basic_file()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::replace(unsigned long, unsigned long, char const*, unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::__detail::_List_node_base::_M_unhook()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::compare(unsigned long, unsigned long, char const*) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::resize(unsigned long, char)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::append(char const*, unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::_M_mutate(unsigned long, unsigned long, unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::rfind(char, unsigned long) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::reserve(unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::ios_base::~ios_base()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::operator=(char const*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::find_first_of(char const*, unsigned long, unsigned long) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::__throw_length_error(char const*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::find(char, unsigned long) const'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::close()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstream()'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::__throw_logic_error(char const*)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >'</font></div>
<div><font face="courier new, monospace" size="1">../lib/libXzeroFlow.so.0.6.0: undefined reference to `std::string::_Rep::_S_empty_rep_storage'</font></div>
<div><font face="courier new, monospace" size="1">clang: error: linker command failed with exit code 1 (use -v to see invocation)</font></div>
<div><br>
</div>
<div><br>
</div>
<div>I first thought, that this is maybe due to the fact, that I am using </div>
<div>-fvisibility=hidden when building the 3 shared libraries, but that's not the case,</div>
<div>as I've completely stripped visibility out and I still don't get my binrary to link.</div>
<div>As a side node, everything works just fine when using GCC (4.6, 4.7) and its libstdc++.</div>
<div><br>
</div>
<div>Does anyone know why ld is refusing to find these symbols (mostly inlined anyways, btw) ?</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>Christian.</div>
</div>
</body>
</html>