[cfe-dev] 回复: C++ Standard Library on Windows

江北才不尽 lifangmu at foxmail.com
Fri Nov 21 06:44:25 PST 2014


clang++ use g++ style(ABI),
 In driver.cpp:
   static const DriverSuffix DriverSuffixes[] = {
      {"clang", nullptr},
      {"clang++", "--driver-mode=g++"},
      {"clang-c++", "--driver-mode=g++"},
      {"clang-cc", nullptr},
      {"clang-cpp", "--driver-mode=cpp"},
      {"clang-g++", "--driver-mode=g++"},
      {"clang-gcc", nullptr},
      {"clang-cl", "--driver-mode=cl"},
      {"cc", nullptr},
      {"cpp", "--driver-mode=cpp"},
      {"cl", "--driver-mode=cl"},
      {"++", "--driver-mode=g++"},
  };
  
 If your must use Microsoft C++ STL Library, your should type clang-cl, it can be created by clang.exe (copy and rename). 


  

 ------------------ 原始邮件 ------------------
  发件人: "Dongsheng Song";<dongsheng.song at gmail.com>;
 发送时间: 2014年11月21日(星期五) 下午3:00
 收件人: "Reid Kleckner"<rnk at google.com>; 
 抄送: "Clang Developers List"<cfe-dev at cs.uiuc.edu>; 
 主题: Re: [cfe-dev] C++ Standard Library on Windows

 

   On Fri, Nov 21, 2014 at 2:11 AM, Reid Kleckner <rnk at google.com> wrote:
  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: 

 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:
 http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/uncaught_exception.h?view=markup




 

 Not works for me (clang 3.5 and VS 2013 U4):

clang++ -D_HAS_EXCEPTIONS=0 hello.cpp
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 at D@std@@@std@@YAAEAV?$basic_ostream at DU?$char_traits at D@std@@@0 at AEAV10@PEBD at Z)
hello-d5bfe1.o : error LNK2001: unresolved external symbol __gxx_personality_v0
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 at DU?$char_traits at D@std@@@std@@QEAA at XZ)
a.out : fatal error LNK1120: 3 unresolved externals
clang++.exe: error: linker command failed with exit code 1120 (use -v to see invocation)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141121/6db4931b/attachment.html>


More information about the cfe-dev mailing list