[cfe-dev] C++ Standard Library on Windows

Seth Cantrell seth.cantrell at gmail.com
Fri Nov 21 06:39:51 PST 2014


clang++.exe defaults to targeting gcc's ABI. Either set it to target msvc
(e.g., '-target i686-pc-windows-msvc') or use clang-cl.exe.

On Nov 21, 2014, at 2:07 AM, Dongsheng Song <dongsheng.song at gmail.com>
wrote:

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)

_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141121/b88f5373/attachment.html>


More information about the cfe-dev mailing list