[cfe-dev] How to use STL with clang++?

way_lzl at sina.com way_lzl at sina.com
Thu Dec 23 23:19:25 PST 2010


Sebastian

Thanks for your reply. I have tried to use STL header of tdm gcc 4.5.1, I don't have gcc 4.2.0 currently, in Mingw and link with ld. The normal STL string, vector, list etc work well. However a simple test case which is pasted below with iostream still can not work. The ld will report can not find external function  _dso_handle and _cxa_atexit. I have used -E option to find where it comes from. It seems LLVM compiler generate them. Some libraries are missed I guess. Could you help me check it?  Or could you help paste the compiler verbose output with -v? Or I have to use gcc 4.2.x?
 
By the way, which linker is recommended to use on Windows? MingW GNU ld or MSVC link? My LLVM is built with VS2005.
 
#include <string>
#include <iostream>
using namespace std;
int main()
{
    string str="test";
    cout << str;    
}

------------------------------------------------
--Zhanglin
----- Original Message -----
From: Sebastian Redl <sebastian.redl at getdesigned.at>
To: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] How to use STL with clang++?
Date: 2010-12-23 16:28:49

On 23.12.2010 04:11, way_lzl at sina.com wrote:
>
> Hello all
>
> Anyone can help me use STL with clang++? My LLVM+Clang was compiled 
> with MSVC8 on Windows7. then I found \Microsoft Visual Studio 
> 8\VC\include is set as the default header file searching path. But c++ 
> with STL will report errors as below:
>
>
There's more than one STL in this world. There's GCC's STL (libstdc++), 
which Clang fully supports up to version 4.2. There's Dinkumware's STL, 
a variant of which is shipped by Microsoft, which Clang does not yet 
support, since it uses lots of MS-specific extensions. There's also 
STLport, an independent project. You don't turn MS's STL to STLport, you 
replace the MSSTL with STLport when you switch to it. I assume Clang 
would support STLport, but you'd have to adapt the STLport configuration 
to recognize and correctly configure Clang. Or maybe someone already 
did; try googling.

We've got two or three people working on making MS's various headers 
work in Clang, but this stuff takes time.

Sebastian

_______________________________________________
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/20101224/b7318a63/attachment.html>


More information about the cfe-dev mailing list