Questions tagged [libstdc++]

Libstdc++ is the GNU implementation of the C++ standard library and is provided as part of GCC

Libstdc++ is the GNU implementation of the C++ standard library, and implements most of C++98/C++03 standard library and in recent releases also supports most of the C++11 library.

It is the default standard library implementation used by G++ and is also often used with the Intel and Clang compilers.

Like the rest of GCC, it is Free Software and runs on a wide range of operating systems and architectures.

Use this tag for questions specific to the libstdc++ implementation, or for related questions.

789 questions
142
votes
19 answers

/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found

How can I get GLIBCXX_3.4.15 in Ubuntu? I can't run some programs that I'm compiling. When I do: strings /usr/lib/libstdc++.so.6 | grep GLIBC I…
Chris
  • 6,642
  • 7
  • 42
  • 55
116
votes
2 answers

Should I use libc++ or libstdc++?

I am developing command line interface executables for both osx and linux using c/c++. The project will link against opencv. Should I use libc++ or libstdc++?
MobileDev
  • 3,750
  • 4
  • 32
  • 35
115
votes
5 answers

Linking libstdc++ statically: any gotchas?

I need to deploy a C++ application built on Ubuntu 12.10 with GCC 4.7's libstdc++ to systems running Ubuntu 10.04, which comes with a considerably older version of libstdc++. Currently, I'm compiling with -static-libstdc++ -static-libgcc, as…
Nick Hutchinson
  • 5,044
  • 5
  • 33
  • 34
107
votes
3 answers

Is gcc 4.8 or earlier buggy about regular expressions?

I am trying to use std::regex in a C++11 piece of code, but it appears that the support is a bit buggy. An example: #include #include int main (int argc, const char * argv[]) { std::regex r("st|mt|tr"); std::cerr <<…
tunnuz
  • 23,338
  • 31
  • 90
  • 128
87
votes
1 answer

What is the purpose of having an empty pair base class?

libstdc++'s implementation of pair has the following oddity template class __pair_base { template friend struct pair; __pair_base() = default; ~__pair_base() = default; __pair_base(const…
Passer By
  • 19,325
  • 6
  • 49
  • 96
87
votes
3 answers

When is it necessary to use the flag -stdlib=libstdc++?

When is it necessary to use use the flag -stdlib=libstdc++ for the compiler and linker when compiling with gcc? Does the compiler automatically use libstdc++? I am using gcc4.8.2 on Ubuntu 13.10 and I would like to use the c++11 standard. I…
Raymond Valdes
  • 1,161
  • 1
  • 9
  • 15
74
votes
1 answer

Using libstdc++ compiled libraries with clang++ -stdlib=libc++

I am working in C++ under Mac OS X (10.8.2) and I recently came up with the need of using C++11 features, which are available through the clang++ compiler using the libc++ stdlib. However, I also need to use some legacy library compiled and linked…
user1690715
  • 841
  • 1
  • 7
  • 5
61
votes
3 answers

Using std::array with initialization lists

Unless I am mistaken, it should be possible to create a std:array in these ways: std::array strings = { "a", "b" }; std::array strings({ "a", "b" }); And yet, using GCC 4.6.1 I am unable to get any of these to work.…
Chris_F
  • 4,991
  • 5
  • 33
  • 63
53
votes
2 answers

Implicit conversion failure from initializer list

Consider the snippet: #include void foo(const std::unordered_map &) {} int main() { foo({}); } This fails with GCC 4.9.2 with the message: map2.cpp:7:19: error: converting to ‘const std::unordered_map’…
bluescarni
  • 3,937
  • 1
  • 22
  • 33
52
votes
5 answers

libstdc++.so.6: version `GLIBCXX_3.4.20' not found

To upload the raw-reads > 2GB to SRA on Genebank, I installed aspera connect plug-in on ubuntu 16.04. But the plug-in did not pop up as indicated by the instruction on the genebank SRA portal. I got this error on the terminal as I initializing the…
Xp.L
  • 837
  • 1
  • 7
  • 13
47
votes
2 answers

How to link C++ object files with ld

I'm trying to link the output of C++ using ld and not g++. I'm only doing this to learn how to do it, not for practical purposes, so please don't suggest just to do it with g++. Looking at this question, the person gets the same error when they run…
gsgx
  • 12,020
  • 25
  • 98
  • 149
45
votes
6 answers

Where can I find GLIBCXX_3.4.29?

I updated my GCC compiler from the GIT repo to version 11. Now my test code (GoogleTest/GoogleMock) is complaining about GLIBCXX_3.4.29 not being found. This is not a duplicate please reopen The answers posted in: Understanding the gcc version and…
James Smith
  • 817
  • 1
  • 4
  • 13
44
votes
3 answers

std::vector (ab)uses automatic storage

Consider the following snippet: #include int main() { using huge_type = std::array; huge_type t; } Obviously it would crash on most of platforms, because the default stack size is usually less than 20MB. Now consider…
Igor R.
  • 14,716
  • 2
  • 49
  • 83
39
votes
1 answer

Bug in the C++ standard library in std::poisson_distribution?

I think I have encountered an incorrect behaviour of std::poisson_distribution from C++ standard library. Questions: Could you confirm it is indeed a bug and not my error? What exactly is wrong in the standard library code of poisson_distribution…
39
votes
3 answers

Is it okay to define a totally general swap() function?

The following snippet: #include #include namespace foo { template void swap(T& a, T& b) { T tmp = std::move(a); a = std::move(b); b = std::move(tmp); } struct bar {…
Tavian Barnes
  • 12,477
  • 4
  • 45
  • 118
1
2 3
52 53