If you use -m32 switch then clang cannot find <string> header.
Works with gcc, but fails with clang.
Try adding -stdlib=libc++ - this will use clang's built-in libc++ standard library instead of GCC's. I'm not sure why this is required, but hopefully you don't need to compare GCC's string implementation.
Thanks, works!
As a side note, I don't see ARM+clang listed. Clang is currently default compiler for ios/android AFAIK.
Yup, that works for #include <atomic> with clang -m32 as well.
Does that mean that with -m64, clang is also using gcc's headers instead of its own? Could this affect code-gen vs. what you'd get from a normal install of clang on a desktop?
Does that mean that with -m64, clang is also using gcc's headers instead of its own? Could this affect code-gen vs. what you'd get from a normal install of clang on a desktop?
Yes; it does.
However, a "normal install" of clang, as best I can tell, uses the GCC toolchain's libstdc, at least on Linux. Apple's builds I believe bundle libc++, but it's a separate project and repository for clang and so requires extra building.
Fixed since clang 5
Most helpful comment
Try adding
-stdlib=libc++- this will use clang's built-in libc++ standard library instead of GCC's. I'm not sure why this is required, but hopefully you don't need to compare GCC's string implementation.