After upgrade to 14.04 from 12.04 clang++ stopped working.

$ cat test.cpp 
#include <iostream>

int main()
        std::cout << "Hello World" << std::endl;
        return 0;

$ clang++ test.cpp 
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
1 error generated

Installed with apt-get install clag-3.5 same happened with clang-3.4


  • 1
    Are you able to compile it with g++? if not use sudo apt-get install libstdc++-4.8-dev – Salem Aug 27 '14 at 21:19
  • 1
    of course g++ works... – Artyom Aug 29 '14 at 4:09
  • @Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang. – Jared Burrows May 10 '15 at 16:51
  • For those who are looking for help: stackoverflow.com/questions/22111549/…. – Jared Burrows May 10 '15 at 17:07

I found to resolve this issue that after installing libstdc++-4.8-dev package, I need to specify the include paths and lib path to the clang++ like this.

clang++ -I/usr/include/c++/4.8/ -I/usr/include/x86_64-linux-gnu/c++/4.8 -L /usr/lib/gcc/x86_64-linux-gnu/4.8 test.cpp -o test
  • I found another way. "clang++ -stdlib=libc++ test.cpp -o test" – Sanya Phungmit Jan 3 '18 at 14:59

Your code works for me. Make sure you have libstdc++-dev installed. It's a virtual package, and in my case (Ubuntu 14.04.2 LTS) having 4.8 works.

sudo apt-get install libstdc++-4.8-dev
  • This doesn't work for me in Ubuntu 14.04.2. – weberc2 Jul 27 '15 at 20:18
  • Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case. – m0j0 Jul 29 '15 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.