Locating iostream in Clang++: fatal error: 'iostream' file not found
I have also been troubled by this problem for a long time.You should try to delete the folder(cd /usr/lib/gcc/aarch64-linux-gnu/8). The reason why clang++ can't work is this folder doesn't contain libstdc++.a.
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/7.3.0
Selected GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/7.3.0
check all the folders in /usr/lib/gcc/aarch64-linux-gnu/ clang++ will choose the last one,make sure there is the libstdc++.a in the last one
I found that clang was using the installation in /usr/lib/gcc/x86_64-linux-gnu/8
(using clang++ -v
), and indeed this did not contain the file libstdc++.a
. Rather than delete the whole directory as suggested by another answer, I was able to just install libstdc++-8-dev
.
I'm on Ubuntu 18.04; gcc was already installed.