Clang 3.1 with lib ++ on ubuntu 12.04, iostream not found

I am trying to compile a program in C ++ using clang, which I installed using the packaged version here https://launchpad.net/~eudoxos/+archive/llvm-3.1 . This is the command:

clang++ -std=c++11 -stdlib=libc++ -g -v -c main.cpp 

And I get this as a result:

 ignoring nonexistent directory "/usr/include/c++/v1" ignoring nonexistent directory "/usr/bin/../lib/clang/3.1/include" ignoring nonexistent directory "" ignoring duplicate directory "/usr/include/x86_64-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/include/clang/3.1/include /usr/include/x86_64-linux-gnu /usr/include main.cpp:1:10: fatal error: 'iostream' file not found #include <iostream> 

As you can see, this is not a search in the correct include directory, / usr / include / c ++ / 4.6. But I think the problem is deeper. Even when I force it to search in this directory, I get the following:

 In file included from main.cpp:1: /usr/include/c++/4.6/iostream:38:10: fatal error: 'bits/c++config.h' file not found #include <bits/c++config.h> 

And this file does not exist in this area. I think it is possible that libC ++ is missing, but before I make a huge mess trying to compile libC ++ from the source (which I doubt will work), since I cannot find any libC ++ ubuntu highlighted package I was hoping you guys could help.

Many thanks!

+8
ubuntu clang libc ++
source share
2 answers

Unfortunately, as far as I know, currently you need to create lib ++ (and possibly lib ++ abi) from the source in order to use -stdlib = lib ++ with clang on Linux.

+3
source share

sudo apt-get install -y clang-3.6 lldb-3.6 lib ++ - dev lib ++ abi-dev

https://gist.github.com/fyears/745da3cf6b19dbff3d0e

0
source share

All Articles