Live data from Hacker News

Using Clang on Windows

arvid.io

1–10 of 30 posts

Re: Using Clang on Windows

#3
"Unfortunately, getting clang to compile MSVC based projects isn't as easy as just dropping in clang and changing a few flags. Let's get started."

Errr, use clang-cl, and "yes it is". That's the whole point of clang-cl :)

Re: Using Clang on Windows

#4
post #2

Looks like this is using clang++ instead of clang-cl, which sets almost all of these flags automatically.

Exactly, In fact clang, clang++ and clang-cl are all the same program. The frontend just behaves differently based on the file name.

Disclaimer: I am a LLVM Engineer working on a mingw-w64 standalone clang :)

Re: Using Clang on Windows

#5
post #3

"Unfortunately, getting clang to compile MSVC based projects isn't as easy as just dropping in clang and changing a few flags. Let's get started." Errr, use clang-cl, and "yes it is". That's the whole point of clang-cl :)

What are the advantages of using clang-cl over the Microsoft c++ compiler?

Re: Using Clang on Windows

#6
post #3

"Unfortunately, getting clang to compile MSVC based projects isn't as easy as just dropping in clang and changing a few flags. Let's get started." Errr, use clang-cl, and "yes it is". That's the whole point of clang-cl :)

What are the advantages of using clang-cl over the Microsoft c++ compiler?

You can add features or fix bugs since it is open source. It might be easier for cross-platform code.

Re: Using Clang on Windows

#7
post #3

"Unfortunately, getting clang to compile MSVC based projects isn't as easy as just dropping in clang and changing a few flags. Let's get started." Errr, use clang-cl, and "yes it is". That's the whole point of clang-cl :)

What are the advantages of using clang-cl over the Microsoft c++ compiler?

By using clang-cl you are getting the advantage of the LLVM backend.

LLVM/Clang can target many different platforms besides windows and it is open source so it is sponsored by many large companies including Google Apple etc.

Google use it for Chrome for example (which includes windows) and have engineers working full time to meet their needs.

Intel, ARM, AMD and co have upstreamed many optimisations into LLVM also.

If you have a bug it probably will be resolved faster. Instead of waiting months for the next Visual Studio Release etc

In general, LLVM because of the intermediate bytecode language and well made libraries like libclang enables new kind of tooling.

Microsoft actually use LLVM themselves in many places and have a bunch of open source projects that use it, which is great

The would actually probably be better off retiring MSVC's c++ compiler and focus on clang along with everyone else because other companies are basically paying for the engineering for their platform with clang.

Unlike gcc the license for llvm/clang is more liberal so if they want private internal tooling they can still do that also.

Re: Using Clang on Windows

#9

I tried using clang-cl recently but it produced a ton of linker errors for basic math functions. Does that mean clang-cl does not provide its own libc? And is there some guide that explains various C options on windows?

Are you trying to compile for MSVC or Mingw libc?

Re: Using Clang on Windows

#10
post #4
post #2

Looks like this is using clang++ instead of clang-cl, which sets almost all of these flags automatically.

Exactly, In fact clang, clang++ and clang-cl are all the same program. The frontend just behaves differently based on the file name. Disclaimer: I am a LLVM Engineer working on a mingw-w64 standalone clang :)

Why is Clang so much slower than cl at compiling? On OS X / unix Clang seems so much faster.
Post reply on HN