Windows에서 clang 3.2를 빌드하고 간단한 hello world 프로그램을 작성하려고했습니다. 그러나 아래에 보이는 것과 같은 많은 오류가 발생합니다.Windows에서 clang으로 C++ 11 프로그램을 컴파일하는 중 오류가 발생했습니다.
d:\Marius\xyz>clang++ -stdlib=libc++ -std=c++11 -Wall xyz.cpp -o xyz.exe
clang++: warning: argument unused during compilation: '-stdlib=libc++'
In file included from xyz.cpp:12:
In file included from ./stdafx.h:18:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\algorithm:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility:8:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\utility:8:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\type_traits:1072:
33: error:
'_Ty' does not refer to a value
_HAS_TRIVIAL_MOVE_CONSTRUCTOR(_Ty)
^
...
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xstddef:540:50: note:
expanded from macro '_VARIADIC_EXPAND_4'
#define _VARIADIC_EXPAND_4(FUNC, X1, X2, X3, X4) \
^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap:222:22:note:
expanded from macro '_CLASS_RESULT_OF_PMF_OPT_0X'
__thiscall, X2, X3, X4)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
VC++ 2012 헤더에서 오는 많은 오류가 발생합니다. Windows에서 clang ++을 사용하여 C++ 11 코드를 작성할 수 있습니까? 추가 명령 스위치를 제공해야합니까?
'-fms-extensions' 가능합니다. – arrowd
사용자 설명서 (http://clang.llvm.org/docs/UsersManual.html)에 따르면이 플래그는 기본적으로 활성화되어 있습니다. 또한 -fmsc-version = 1700 (즉 VS2012) 및 -fdelayed-template-parsing (기본값이어야 함) 설정을 시도했습니다. 결과가 없다. stdafx.h를 제거해도 컴파일 오류에는 영향을주지 않습니다. –
또한 mingw 헤더를 -isystem과 함께 사용하려고 시도했지만 구성 악몽처럼 보입니다. 인클루드 순서에 따라 다른 오류가 발생하고 컴파일 오류없이 주문을 설정할 수 없습니다. –