What is libc++ and libstdc++
Asked Answered
A

2

12

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 ?

Ardellaardelle answered 18/11, 2016 at 11:39 Comment(1)
Related: #14972925Sankaran
T
14

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++.

Thrifty answered 6/9, 2022 at 23:36 Comment(0)
I
10

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.

Inaccurate answered 18/11, 2016 at 11:53 Comment(2)
While point 5 is theoretically true, I've encountered several instances where one is buggy so you have to use the other. For instance, regex's with libc on Ubuntu 14.04.Weird
Saying entire different in this case, for differences doesn't help a bit :)Regrate

© 2022 - 2024 — McMap. All rights reserved.