<DIV>clang++ use g++ style(ABI),</DIV>
<DIV>In driver.cpp:</DIV>
<DIV>  static const DriverSuffix DriverSuffixes[] = {<BR>      {"clang", nullptr},<BR>      {"clang++", "--driver-mode=g++"},<BR>      {"clang-c++", "--driver-mode=g++"},<BR>      {"clang-cc", nullptr},<BR>      {"clang-cpp", "--driver-mode=cpp"},<BR>      {"clang-g++", "--driver-mode=g++"},<BR>      {"clang-gcc", nullptr},<BR>      {"clang-cl", "--driver-mode=cl"},<BR>      {"cc", nullptr},<BR>      {"cpp", "--driver-mode=cpp"},<BR>      {"cl", "--driver-mode=cl"},<BR>      {"++", "--driver-mode=g++"},<BR>  };</DIV>
<DIV> </DIV>
<DIV>If your must use Microsoft C++ STL Library, your should type clang-cl, it can be created by clang.exe (copy and rename). <BR><BR></DIV>
<DIV>
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 12px; FONT-FAMILY: Arial Narrow; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px">------------------ 原始邮件 ------------------</DIV>
<DIV style="FONT-SIZE: 12px; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px">
<DIV><B>发件人:</B> "Dongsheng Song";<dongsheng.song@gmail.com>;</DIV>
<DIV><B>发送时间:</B> 2014年11月21日(星期五) 下午3:00</DIV>
<DIV><B>收件人:</B> "Reid Kleckner"<rnk@google.com>; <WBR></DIV>
<DIV><B>抄送:</B> "Clang Developers List"<cfe-dev@cs.uiuc.edu>; <WBR></DIV>
<DIV><B>主题:</B> Re: [cfe-dev] C++ Standard Library on Windows</DIV></DIV>
<DIV><BR></DIV>
<DIV dir=ltr>
<DIV class=gmail_extra>
<DIV class=gmail_quote>On Fri, Nov 21, 2014 at 2:11 AM, Reid Kleckner <SPAN dir=ltr><<A href="mailto:rnk@google.com" target=_blank>rnk@google.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV dir=ltr>Currently I don't think we have a solid preferred choice for a Windows standard C++ library to use with Clang. There are only tradeoffs and options:
<DIV><BR></DIV>
<DIV>MSVC's STL: The 2013 version should work out of the box right now, but exceptions don't work and you have to disable them with -D_HAS_EXCEPTIONS=0. This option is good if you want to link against other C++ code built with MSVC. I care about this config, so if you hit snags I'd like to know. There is a known issue with the C++11 threading headers and -D_HAS_EXCEPTIONS=0, which is described in this file in LLDB:</DIV>
<DIV><A href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/uncaught_exception.h?view=markup" target=_blank>http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/uncaught_exception.h?view=markup</A><BR></DIV><BR></DIV><BR></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>Not works for me (clang 3.5 and VS 2013 U4):<BR><BR>clang++ -D_HAS_EXCEPTIONS=0 hello.cpp<BR>hello-d5bfe1.o : error LNK2019: unresolved external symbol _Unwind_Resume referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z)<BR>hello-d5bfe1.o : error LNK2001: unresolved external symbol __gxx_personality_v0<BR>hello-d5bfe1.o : error LNK2019: unresolved external symbol __cxa_call_unexpected referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ)<BR>a.out : fatal error LNK1120: 3 unresolved externals<BR>clang++.exe: error: linker command failed with exit code 1120 (use -v to see invocation)<BR><BR></DIV></DIV></DIV></DIV>
<DIV></DIV></DIV>