libcxx : simple hello world failed

Hi all,

I’m trying to do a simple hello world using libc++ but I got the following link error :

/usr/local/lib/libc++.so: undefined reference to std::__1::locale::locale()' /usr/local/lib/libc++.so: undefined reference to std::__1::num_get<wchar_t, std::__1::istreambuf_iterator<wchar_t, std::__1::char_traits<wchar_t> > >::id’
/usr/local/lib/libc++.so: undefined reference to std::__1::codecvt<char, char, __mbstate_t>::id' /usr/local/lib/libc++.so: undefined reference to std::__1::locale::operator=(std::__1::locale const&)’
/usr/local/lib/libc++.so: undefined reference to std::__1::__throw_runtime_error(char const*)' /usr/local/lib/libc++.so: undefined reference to std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits > >::id’
/usr/local/lib/libc++.so: undefined reference to std::__1::num_put<wchar_t, std::__1::ostreambuf_iterator<wchar_t, std::__1::char_traits<wchar_t> > >::id' /usr/local/lib/libc++.so: undefined reference to std::__1::ctype::id’
/usr/local/lib/libc++.so: undefined reference to std::__1::num_get<char, std::__1::istreambuf_iterator<char, std::__1::char_traits<char> > >::id' /usr/local/lib/libc++.so: undefined reference to std::__1::codecvt<wchar_t, char, __mbstate_t>::id’
/usr/local/lib/libc++.so: undefined reference to std::__1::__vector_base_common<true>::__throw_length_error() const' /usr/local/lib/libc++.so: undefined reference to std::__1::locale::locale(std::__1::locale const&)’
/usr/local/lib/libc++.so: undefined reference to std::__1::locale::use_facet(std::__1::locale::id&) const' /usr/local/lib/libc++.so: undefined reference to std::__1::locale::~locale()’
/usr/local/lib/libc++.so: undefined reference to `std::__1::ctype<wchar_t>::id’

I use the latest revision of both clang and libc++.

Any ideas ?

Best regards,

Jaonary

Are you linking against libc++ at all?

Sebastian

Jaonary Rabarisoa <jaonary@...> writes:

Hi all,

I'm trying to do a simple hello world using libc++ but I got the following

link error :

/usr/local/lib/libc++.so: undefined reference to `std::__1::locale::locale()'
/usr/local/lib/libc++.so: undefined reference to `std::__1::num_get<wchar_t,

std::__1::istreambuf_iterator<wchar_t, std::__1::char_traits<wchar_t> > >::id'

/usr/local/lib/libc++.so: undefined reference to `std::__1::codecvt<char,

char, __mbstate_t>::id'

/usr/local/lib/libc++.so: undefined reference to

`std::__1::locale::operator=(std::__1::locale const&)'

/usr/local/lib/libc++.so: undefined reference to

`std::__1::__throw_runtime_error(char const*)'

/usr/local/lib/libc++.so: undefined reference to `std::__1::num_put<char,

std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'

/usr/local/lib/libc++.so: undefined reference to `std::__1::num_put<wchar_t,

std::__1::ostreambuf_iterator<wchar_t, std::__1::char_traits<wchar_t> > >::id'

/usr/local/lib/libc++.so: undefined reference to `std::__1::ctype<char>::id'
/usr/local/lib/libc++.so: undefined reference to `std::__1::num_get<char,

std::__1::istreambuf_iterator<char, std::__1::char_traits<char> > >::id'

/usr/local/lib/libc++.so: undefined reference to `std::__1::codecvt<wchar_t,

char, __mbstate_t>::id'

/usr/local/lib/libc++.so: undefined reference to

`std::__1::__vector_base_common<true>::__throw_length_error() const'

/usr/local/lib/libc++.so: undefined reference to

`std::__1::locale::locale(std::__1::locale const&)'

/usr/local/lib/libc++.so: undefined reference to

`std::__1::locale::use_facet(std::__1::locale::id&) const'

/usr/local/lib/libc++.so: undefined reference to `std::__1::locale::~locale()'
/usr/local/lib/libc++.so: undefined reference to `std::__1::ctype<wchar_t>::id'

I use the latest revision of both clang and libc++.

Any ideas ?

http://llvm.org/svn/llvm-project/libcxx/trunk/src/locale.cpp

Look just below the #include's... I'd guess you're running on something other
than an Apple system?

http://comments.gmane.org/gmane.comp.compilers.clang.devel/10285

Looks like "patches welcome".