Installation help

I am trying to install clang on a windows machine. I did successfully compile clang by using cmake and the mingw-makefile option. This compiled clang for me. However I noted when clang was being built cmake decided to use the Microsoft compiler (and I would have preferred it to use gcc), and when I run clang it insists on using the Microsoft header files and this seems to cause a problem as follows:

When I compile a simple “Hello World” style program I get the following errors as shown below.

The same file compiles and runs quite happily when I use g++ (via mingw).

Is there any way to force cmake to use g++ instead of the Microsoft compiler

Is there any way to force the system to use the gcc header files instead of the Microsoft version

Is there a version of Clang available precompiled for a windows platform?

Thanks for any help

Z:\clang>build\bin\clang++ test1.cpp

In file included from test1.cpp:1:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\iostream:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\istream:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ostream:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ios:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocnum:10:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\streambuf:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xiosbase:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocale:8:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdexcept:7:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstring:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xmemory0:942:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:27:

Z:\clang\build\bin…\lib\clang\3.4\include\ammintrin.h:28:2: error: "SSE4A

instruction set not enabled"

#error “SSE4A instruction set not enabled”

^

In file included from test1.cpp:1:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\iostream:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\istream:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ostream:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ios:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocnum:10:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\streambuf:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xiosbase:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocale:8:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdexcept:7:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstring:6:

In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xmemory0:942:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:527:20:

error:

expected unqualified-id

__MACHINEX86(__m64 _m_pshufw(__m64, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:986:19: note: expanded

from macro ‘_m_pshufw’

#define _m_pshufw _mm_shuffle_pi16

^

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:749:32: note: expanded

from macro ‘_mm_shuffle_pi16’

#define _mm_shuffle_pi16(a, n) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:862:23:

error:

C++ requires a type specifier for all declarations

__MACHINEX86_X64(void _mm_prefetch(char const *, int))

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:678:51: note: expanded

from macro ‘_mm_prefetch’

#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

~^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:862:23:

error:

function cannot return function type ‘int (const char *)’

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:678:50: note: expanded

from macro ‘_mm_prefetch’

#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:862:23:

error:

expected parameter declarator

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:678:63: note: expanded

from macro ‘_mm_prefetch’

#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:862:23:

error:

expected ‘)’

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:678:63: note: expanded

from macro ‘_mm_prefetch’

#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:862:23:

note:

to match this ‘(’

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:678:49: note: expanded

from macro ‘_mm_prefetch’

#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:910:26:

error:

expected unqualified-id

__MACHINEX86_X64(__m128i _mm_shuffle_epi32(__m128i, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\emmintrin.h:1274:35: note: expanded

from macro ‘_mm_shuffle_epi32’

#define _mm_shuffle_epi32(a, imm) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:912:26:

error:

expected unqualified-id

__MACHINEX86_X64(__m128d _mm_shuffle_pd(__m128d, __m128d, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\emmintrin.h:1380:33: note: expanded

from macro ‘_mm_shuffle_pd’

#define _mm_shuffle_pd(a, b, i) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:914:25:

error:

expected unqualified-id

__MACHINEX86_X64(__m128 _mm_shuffle_ps(__m128, __m128, unsigned int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\xmmintrin.h:789:36: note: expanded

from macro ‘_mm_shuffle_ps’

#define _mm_shuffle_ps(a, b, mask) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:915:26:

error:

expected unqualified-id

__MACHINEX86_X64(__m128i _mm_shufflehi_epi16(__m128i, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\emmintrin.h:1287:37: note: expanded

from macro ‘_mm_shufflehi_epi16’

#define _mm_shufflehi_epi16(a, imm) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:916:26:

error:

expected unqualified-id

__MACHINEX86_X64(__m128i _mm_shufflelo_epi16(__m128i, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\emmintrin.h:1280:37: note: expanded

from macro ‘_mm_shufflelo_epi16’

#define _mm_shufflelo_epi16(a, imm) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:929:26:

error:

expected unqualified-id

__MACHINEX86_X64(__m128i _mm_slli_si128(__m128i, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\emmintrin.h:828:34: note: expanded

from macro ‘_mm_slli_si128’

#define _mm_slli_si128(a, count) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:944:26:

error:

expected unqualified-id

__MACHINEX86_X64(__m128i _mm_srli_si128(__m128i, int))

^

Z:\clang\build\bin…\lib\clang\3.4\include\emmintrin.h:893:34: note: expanded

from macro ‘_mm_srli_si128’

#define _mm_srli_si128(a, count) extension ({ \

^

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\intrin.h:68:29: n

ote:

expanded from macro ‘__MACHINE’

#define __MACHINE(X) X;

^

13 errors generated.

Yours

David Waller