I am trying to compile a C++ program using clang which I installed using a 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 the 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, it is not searching in the correct include directory, /usr/include/c++/4.6. But I think the issue is deeper than that. Even when I force it to search in that directory, I get this:
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 that file doesn't exist in that area. I am thinking maybe libc++ is missing, but before I make a huge mess trying to compile libc++ from source (which I doubt will work) since I cannot find any dedicated libc++ ubuntu package, I was hoping you guys could help out.
Thanks very much!
Unfortunately, as far as I know you currently need to build libc++ (and possibly libc++abi as well) from source to use -stdlib=libc++ with clang on Linux.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With