Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Clang with MSVC 2010

First of all, I want to ask if Clang compiler is better than MSVC's default compiler? And how can I use Clang with MSVC? For example, I write code in MSVC then when I hit Build, it call Clang to build the project.

like image 810
Ethan Avatar asked Jan 14 '11 03:01

Ethan


People also ask

Does Clang use MSVC?

By default, Clang uses the target x86_64-pc-windows-msvc when compiling on Windows. With this target, Clang will look for Microsoft's msvc linker on PATH and use it for linking. If you want to go that route, install Microsoft Visual Studio.

Is Clang better than MSVC?

When I switched to both clang and MSVC 64-bit versions, I see MSVC is faster than clang by about 1.5X. On 32-bit toolsets, I saw that MSVC is 2X slower than Clang. This, however, is totally believable because MSVC performance is tracked mostly on the 64-bit toolset.

Is MinGW better than MSVC?

MSVC is doing the compilation job significantly faster than MinGW-w64. The DLL sizes are comparable, if optimization is set to "-O2" for MinGW-w64, with "-O3" the DLLs from MinGW-w64 are larger. Binary files compiled with MinGW-w64 are performing significantly better than those compiled with MSVC.

Is GCC faster than MSVC?

GCC is a fine compiler, and can produce code that has pretty much the same performance, if not better, than MSVC.


2 Answers

https://github.com/ishani/ClangVSx

AddIn for Visual Studio 2010 that allows use of the Clang C/C++ compiler in place of MSVC++. Translates VC project and build settings into gcc-friendly command line arguments, along with existing platform tools (MSVC Linker, Librarian, RC) to complete the build chain.

like image 72
Harry Denholm Avatar answered Sep 28 '22 08:09

Harry Denholm


Using clang compiler on Windows is still considered to be in experimental state. However, some progress has been made recently. As I answered similar question:

LLVM provides Windows snapshot builds - a clang toolset for Visual Studio as Windows installer. Currently it should integrate with Visual Studio 2010, 2012 and 2013. More information can be found on LLVM's blog post A path forward for an LLVM toolchain on Windows.

like image 29
Paweł Bylica Avatar answered Sep 28 '22 06:09

Paweł Bylica