Therhang
Therhang

Reputation: 835

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. 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?

Upvotes: 18

Views: 14714

Answers (2)

Mats Petersson
Mats Petersson

Reputation: 129504

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.

Upvotes: 10

Bill Lynch
Bill Lynch

Reputation: 81986

They do have a c++ standard library: libcxx.llvm.org. But it's not fully supported on the windows platform.

Upvotes: 3

Related Questions