Why doesn't Clang come with standard library headers?

痞子三分冷 提交于 2019-12-10 12:31:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!