为什么Clang没有标准库头文件? [英] Why doesn't Clang come with standard library headers?

查看:2554
本文介绍了为什么Clang没有标准库头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从这个网站下载了Clang 3.6.2,并尝试使用代码设置:: Windows下的块。不幸的是,它不能编译一个简单的hello world程序,因为它不知道 iostream 在哪里。

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?

推荐答案

标准库不是编译器本身的一部分。它是特定平台上的运行时环境的一部分。当然,一些组织将kit与所有必要的部分组成一个应用程序 - 甚至可能有人用一个合适的运行时打包一个Clang编译器。

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.

一般来说,您应该可以下载 Windows SDK 并获取相关的头文件 - 如果你使用 clang-cl ,它应该在很大程度上兼容MSVC编译器[或使用正确的 -fms-compatibility clang 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].

或者如另一个答案中所建议的,使用 libcxx 但它不是100%完成Windows。

Or as suggested in the other answer, use libcxx, but it's not 100% complete for Windows.

这篇关于为什么Clang没有标准库头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆