[cfe-dev] STL from libcxx looks for libc?

Howard Hinnant hhinnant at apple.com
Sun Jul 22 14:09:51 PDT 2012


On Jul 22, 2012, at 5:01 PM, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:

> I'm developing on a bare-metal cortex-m3 in C++ for fun and profit.
> 
> I recently decided to switch from GCC to clang.
> 
> I managed to set-up clang for cross-compiling for thumb2 (thanks to the
> guys on llvm-dev mailing list).
> 
> Since I also needed to use the list container from STL, I installed libcxx.
> 
> I thought that as long as I give my own allocator, I shouldn't get anything
> else more the what I use.
> 
> The compiler does find the library, but I get the following error
> 
> In file included from /home/emitrax/bin/llvm/lib/c++/v1/list:177:
> In file included from /home/emitrax/bin/llvm/lib/c++/v1/algorithm:596:
> /home/emitrax/bin/llvm/lib/c++/v1/cstdlib:96:9: error: no member named
> 'lldiv_t' in the global namespace
> using ::lldiv_t;
> 
> etc...
> 
> I don't understand why it uses the cstdlib in the first place?
> 
> The symbol is declared in stdlib.h (that's what I get from man lldiv_t).
> Is there some header inclusion missing?

<cstdlib> includes <stdlib.h>.

I believe <algorithm> could change <cstdlib> to <cstddef> and be fine.  It needs size_t. I suspect I originally included <cstdlib> to use rand, but random_shuffle has since changed to use the technology in <random>.

I'll put the switch from <cstdlib> to <cstddef> on my to-do list.  Should be easy, I just need to retest.

Howard




More information about the cfe-dev mailing list