clang++ fails to compile simple hello world c++ program

Solution 1:

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