问题
I downloaded Clang 3.6.2 from this website and am trying to set it up with Code::Blocks under Windows. Unfortunately, it fails to compile a simple "hello world" program on the grounds that it doesn't know where iostream
is.
Looking through the install folder, it does not appear to include a standard library with it. Why? And how do I get it?
回答1:
The standard library is NOT part of the compiler itself. It is part of the runtime environment on a particular platform. Sure, some organisations put together a "kit" with all the necessary parts to build an application - there may even be someone that packages a Clang compiler with a suitable runtime.
In general, you should be able to download the Windows SDK and get the relevant header files there - and if you use clang-cl
, it should be largely compatible with the MSVC compiler [or provide clang
or clang++
with the correct -fms-compatibility
or whatever it is called].
Or as suggested in the other answer, use libcxx
, but it's not 100% complete for Windows.
回答2:
They do have a c++ standard library: libcxx.llvm.org. But it's not fully supported on the windows platform.
来源:https://stackoverflow.com/questions/31554182/why-doesnt-clang-come-with-standard-library-headers