[cfe-dev] Problems with -stdlib=libc++

James Dennett james.dennett at gmail.com
Mon Aug 20 05:13:23 PDT 2012


On Mon, Aug 20, 2012 at 4:48 AM, Michael Lehn <michael.lehn at uni-ulm.de> wrote:
> Im sitting here in front of a new iMac:
> (a)  I installed the latest XCode and its command line tool.
> (b)  I also installed clang-3.1 and clang-3.2 from MacPorts.
>
> Now I can not compile a simple program "main.cc" like
>
> -----------------------
> #include <complex>
> #include <type_traits>
> int main() {}
> -----------------------
>
> neither
> (1)     clang++ -std=c++11 -std=libc++ main.cc
> nor
> (2)     clang++ -std=c++11 main.cc
> work.  In (1) 'complex' can not be found; in (2) 'type_traits' can
> not be found.
>
> I guess this is a configuration problem.  On other machines with an
> older XCode and older MacPorts and older ... everything is fine. But
> maybe there is somebody out there who had the same problem recently.
> At the moment I don't know where I should start to track down the
> problem.

First: which clang++ are you running?

On this machine I see
$ which clang++
/usr/bin/clang++
$ clang++ -v
Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.0.0
Thread model: posix

after installing just the XCode command line tools (nothing from
MacPorts), and while

$ clang++ -std=c++11 small.cc
small.cc:2:10: fatal error: 'type_traits' file not found
#include <type_traits>
         ^
1 error generated.

fails, with -stdlib=libc++ the command

$ clang++ -std=c++11 -stdlib=libc++ small.cc
$ ./a.out

works as expected.

-- James



More information about the cfe-dev mailing list