18

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?

Therhang
  • 825
  • 1
  • 9
  • 15
  • I had that same issue on Linux. clang++ didn't come with headers and erroneously looked at gcc installations (not g++) to try and figure out where it could find them,and then once it decided what directory it thought they were in - it never looked to see if they were actually there. I had to download a later version of g++ to match what gcc was there in order to get clang++ to work. – Scooter Jul 22 '15 at 12:40

2 Answers2

10

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.

Mats Petersson
  • 126,704
  • 14
  • 140
  • 227
3

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

Bill Lynch
  • 80,138
  • 16
  • 128
  • 173
  • Not fully supported? Can you elaborate? – Therhang Jul 22 '15 at 05:10
  • @Therhang, Last I heard, the exception situation (IIRC, the Structured Exception Handling side) was a difficult problem. – chris Jul 22 '15 at 05:12
  • 1
    @Therhang: On their website, they have a list of supported platforms. It doesn't include Windows. But they do say: _"Ports to other platforms are underway. Here are recent test results for Windows and Linux."_ – Bill Lynch Jul 22 '15 at 05:14