0

I recently upgraded by Ubuntu and clang++-5.0 is unable to find iostream header file.

> clang++-5.0 a.cpp
a.cpp:2:9: fatal error: 'iostream' file not found
#include<iostream>
        ^~~~~~~~~~
1 error generated.

I can see that clang does have access to libstdc++

> ldd /usr/bin/clang++-5.0
    linux-vdso.so.1 =>  (0x00007fffecfce000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007feee4770000)
    libLLVM-5.0.so.1 => /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1 (0x00007feee11b0000)
    libjsoncpp.so.1 => /usr/lib/x86_64-linux-gnu/libjsoncpp.so.1 (0x00007feee0f70000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007feee0bd0000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007feee08c0000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007feee06a0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feee02c0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007feee4a00000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007feee00b0000)
    libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2 (0x00007feedfe70000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007feedfc50000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007feedfa20000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007feedf800000)
    libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007feedf5d0000)

I am not really sure what is missing. It will be great if someone can help me at this. Thanks

samar
  • 99
  • 1
  • 1
  • 7
  • Did you read this? https://stackoverflow.com/questions/26333823/clang-doesnt-see-basic-headers – Gonzalo Lorieto Aug 08 '18 at 21:24
  • Yes, that solves it. Thanks. I didn't try that earlier as I thought that libstdc++.so.6 is already being linked. It will be great if you can tell what difference did "-stdlib=libc++" make when the library was already being linked. (libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007feee0bd0000) – samar Aug 08 '18 at 21:47
  • Possible duplicate of [Clang doesn't see basic headers](https://stackoverflow.com/questions/26333823/clang-doesnt-see-basic-headers) – Mike Kinghan Aug 14 '18 at 14:36

0 Answers0