What is libc++ and libstdc++

I have a couple of questions.

1) What is libc++ and libstdc++ ?

2) What is the difference between them ?

3) Are they interchangeable ?

4) Is it something a compiler should implement ?

5) When should I use one or another ?

Upvotes: 12

Views: 10844

Answers (2)

Tom Huntington
Tom Huntington

Reputation: 3415

libstdc++ is the GNU c++ standard library implementation.

libc++ is the LLVM/clang c++ standard library implementation.

Even when compiling with clang, libstdc++ (gnu) is often used (on Linux).

A main reason libc++ (clang) exists is that libstdc++ (gnu) is GPL and so Apple can't ship it, so you can think of libc++ as the non-GPL libstdc++.

Upvotes: 16

EricWF
EricWF

Reputation: 1061

1) What is libc++ and libstdc++ ?

They are implementations of the C++ standard library.

2) What is the difference between them ?

They are entirely different implementations.

3) Are they interchangeable ?

Yes, you should be able to use them interchangeably. (However you can't easily use both in the same program.)

5) When should I use one or another ?

You shouldn't have to worry about that. Your code should work with any standard library implementation.

Upvotes: 10

Related Questions