How to use STL with clang++?

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

Hi there! I am a new one here…

Contributing in this area sounds like a good start point to me.
How could I get started working on the MSVC support in clang?

Cheers!
Juan

2010/12/23 Sebastian Redl <sebastian.redl@getdesigned.at>

2010/12/22 <way_lzl@sina.com>

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:


C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include/iosfwd(212) : error
:
no member named ‘_invalid_parameter_noinfo’ in the global namespace; did
you mean ‘_invalid_parameter_handler’?
_SCL_SECURE_CRT_VALIDATE(_Dest_size >= _Count, NULL);

This particular error is because _invalid_parameter_noinfo is not defined at this point.
I did an experiment where I flag everything as template dependent in Microsoft mode.
It kinda work but i am not ready to submit anything yet about this.

2010/12/23 Juan Rubén Segovia <juanruben82@gmail.com>

Hi there! I am a new one here…

Contributing in this area sounds like a good start point to me.
How could I get started working on the MSVC support in clang?

Cheers!
Juan

Great I really need help to improve MSVC compatibility.

I did some progress to improve MSVC compatibility in the last months. Up to now I limited myself to parsing the .h included with MSVC 2008 in -fsyntax-only mode. Currently all the .h without template code will parse correctly. I haven’t really tried parsing any .c or .cpp files yet.

I suggest you download a large MSVC source code base, try to parse it with clang, see what the errors are and submit patches that will fix them to clang-commit.

Avoid source base that depends on MSVC template header files. They won’t compile, this is something I am currently investigating but it is far from trivial.

Another thing: clang doesn’t have a MSVC compatible driver. That could be a great project to work on.