<DT>Paul</DT>
<DT> </DT>
<DT>Thanks for your suggestion. I have used mingw GCC's STL headers with an extra macro<FONT color=#ff0000>__MSVCRT_<BR>_ <FONT color=#000000>without which compiler reports fgetws is not declared</FONT>,</FONT> then the compilation is OK but link has error. </DT>
<DT>------------------------------------------------</DT>
<P> $ clang++  -I/c/mingw/lib/gcc/mingw32/4.5.1/include/c++/ -I/c/mingw/lib/gcc/min<BR>gw32/4.5.1/include/c++/mingw32 -I/c/mingw/lib/gcc/mingw32/4.5.1/include/c++/bac<BR>kward -I/c/MinGW/lib/gcc/mingw32/4.5.1/../../../../include -I/c/MinGW/lib/gcc/m<BR>ingw32/4.5.1/include -I/c/MinGW/lib/gcc/mingw32/4.5.1/include-fixed -D<FONT color=#ff0000>__MSVCRT_<BR>_</FONT> str.cpp<BR>cc-000000.o : error LNK2001: unresolved external symbol __ZNSaIcEC1Ev<BR>cc-000000.o : error LNK2001: unresolved external symbol __ZNSsC1EPKcRKSaIcE<BR>cc-000000.o : error LNK2001: unresolved external symbol __ZNSaIcED1Ev<BR>cc-000000.o : error LNK2001: unresolved external symbol __ZNSsD1Ev<BR>a.out : fatal error LNK1120: 4 unresolved externals</P>
<DT>------------------------------------------------</DT>
<P> </P>
<DT>After using -v I noticed the LLVM uses MSVC's linker, so I just tried GCC's linker, it runs OK. </DT>
<P> </P>
<P>But... If I used iostream, the GCC's linker will report undefiend reference to _dso_handle and _cxa_atexit.</P>
<P> </P>
<P>Any suggestion? Thanks.</P>
<DT><BR>--Zhanglin</DT>
<DT><BR>----- Original Message -----<BR>From: Paul Davey <plmdvy@gmail.com><BR>To: way_lzl@sina.com<BR>Subject: Re: [cfe-dev] How to use STL with clang++?<BR>Date: 2010-12-23 11:31:40<BR><BR>2010/12/23 <way_lzl@sina.com>:<BR>> Hello all<BR>><BR>><BR>><BR>> Anyone can help me use STL with clang++? My LLVM+Clang was compiled with<BR>> MSVC8 on Windows7. then I found \Microsoft Visual Studio 8\VC\include is set<BR>> as the default header file searching path. But c++ with STL will report<BR>> errors as below:<BR>><BR>> ----------------------------------------------------------------------------------------------<BR>><BR>> C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include/iosfwd(212) :<BR>> error<BR>> :<BR>> no member named '_invalid_parameter_noinfo' in the global namespace;<BR>> did<BR>> you mean '_invalid_parameter_handler'?<BR>> _SCL_SECURE_CRT_VALIDATE(_Dest_size >= _Count, NULL);<BR>><BR>> ----------------------------------------------------------------------------------------------<BR>><BR>><BR>><BR>> I guess MSVC's STL is compatible then turned to STLport, but it still can<BR>> not work neither.<BR>><BR>> ----------------------------------------------------------------------------------------------<BR>><BR>> In file included from ../STLport-5.2.1/stlport/stl/config/_system.h:160:<BR>> ../STLport-5.2.1/stlport/stl/config/_windows.h(108) : error: unknown type<BR>> name<BR>> '_STLP_IMPORT_DECLSPEC'<BR>><BR>> ----------------------------------------------------------------------------------------------<BR>><BR>><BR>><BR>> However the LLVM's online compiler <A href="http://llvm.org/demo/" target=_blank>http://llvm.org/demo/</A> can compile STL<BR>> successfully. Anything is wrong? Anything I missed? Or I need llvm-gcc?<BR>><BR>clang++ cannot use msvc's c++ headers yet. You must use mingw's STL<BR>headers and library. This should happen if you build it with mingw<BR>automatically. Otherwise you have to change a bunch of things, using<BR>ti with msvc is experimental and the C++ is not going to work unless<BR>you use no standard libs.<BR></DT>