简体   繁体   English

为什么Clang不带标准库头?

[英]Why doesn't Clang come with standard library headers?

I downloaded Clang 3.6.2 from this website and am trying to set it up with Code::Blocks under Windows. 我从这个网站下载了Clang 3.6.2,并尝试使用Windows下的Code :: Blocks进行设置。 Unfortunately, it fails to compile a simple "hello world" program on the grounds that it doesn't know where iostream is. 不幸的是,它无法编译一个简单的“hello world”程序,理由是它不知道iostream在哪里。

Looking through the install folder, it does not appear to include a standard library with it. 查看安装文件夹,它似乎没有包含标准库。 Why? 为什么? And how do I get it? 我怎么得到它?

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. 当然,一些组织将一个“工具包”与构建应用程序的所有必要部分组合在一起 - 甚至可能有人将Clang编译器打包到合适的运行时。

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]. 通常,您应该能够下载Windows SDK并获取相关的头文件 - 如果您使用clang-cl ,它应该与MSVC编译器基本兼容[或者提供具有正确-fms-compatibility clangclang++或者不管它叫什么。

Or as suggested in the other answer, use libcxx , but it's not 100% complete for Windows. 或者如其他答案中所建议的那样,使用libcxx ,但它不是100%完整的Windows。

They do have a c++ standard library: libcxx.llvm.org . 他们有一个c ++标准库: libcxx.llvm.org But it's not fully supported on the windows platform. 但它并没有完全支持Windows平台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM