[cfe-dev] Undefined reference to `std::basic_string<char>... error

Eric Christopher echristo at apple.com
Fri Jan 21 00:52:49 PST 2011


On Jan 20, 2011, at 9:18 PM, Asudani, Mohit wrote:

> Hi  Clang Developers,
>  
> I downloaded the latest revision (r123891) of LLVM via SVN and followed the instructions at http://clang.llvm.org/get_started.html  to configure and build.
>  
> While building I received  following error:
>  
> Linking Debug+Asserts executable FileCheck
> /u/asudani/project/build/Debug+Asserts/lib/libLLVMSupport.a(Program.o): In function `char* std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag)':
> /usr/software/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/basic_string.tcc:158: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_set_length_and_sharable(unsigned long)
>  
> Searching for error directed me to forum suggesting addition of –lstdc++ linker option:http://www.codeguru.com/forum/archive/index.php/t-351875.html.
> I tried to modify makefile but it didn’t worked. What is the best way to modify LDFLAGS for incorporating the specified option ?
>  
>  
> After looking logs for past revisions, one of them (r121379) yielded:
>  
> r121379 | mspencer | 2010-12-09 23:06:48 +0530 (Thu, 09 Dec 2010) | 1 line
> Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec.
> And fix clients.
>  
>  
> I want to know if these observations are related in any way and if this is known error and has been encountered before by users.
>  
>  

http://llvm.org/docs/GettingStarted.html#brokengcc

-eric



More information about the cfe-dev mailing list