libstdc++

How to link with libstdc++_pic.a with GCC?

喜夏-厌秋 提交于 2020-02-06 11:27:37
问题 I have a libstdc++_pic.a on my system (Ubuntu 12.04, gcc 4.6.3), presumably this is the version of libstdc++ created with -fPIC. I also have a libstdc++.a. I see the following error when I try to statically link libstdc++ with a shared library via the -static-libstdc++ link flag: :-1: error: /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_exception::~bad_exception()' can not be used when making a shared object; recompile with -fPIC So I'm

How to link with libstdc++_pic.a with GCC?

前提是你 提交于 2020-02-06 11:22:09
问题 I have a libstdc++_pic.a on my system (Ubuntu 12.04, gcc 4.6.3), presumably this is the version of libstdc++ created with -fPIC. I also have a libstdc++.a. I see the following error when I try to statically link libstdc++ with a shared library via the -static-libstdc++ link flag: :-1: error: /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_exception::~bad_exception()' can not be used when making a shared object; recompile with -fPIC So I'm

Is gcc 4.8 or earlier buggy about regular expressions?

牧云@^-^@ 提交于 2020-02-05 09:13:49
问题 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 <regex> #include <iostream> int main (int argc, const char * argv[]) { std::regex r("st|mt|tr"); std::cerr << "st|mt|tr" << " matches st? " << std::regex_match("st", r) << std::endl; std::cerr << "st|mt|tr" << " matches mt? " << std::regex_match("mt", r) << std::endl; std::cerr << "st|mt|tr" << " matches tr? " << std::regex_match("tr", r) << std::endl; } outputs: st|mt

Is gcc 4.8 or earlier buggy about regular expressions?

允我心安 提交于 2020-02-05 09:13:06
问题 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 <regex> #include <iostream> int main (int argc, const char * argv[]) { std::regex r("st|mt|tr"); std::cerr << "st|mt|tr" << " matches st? " << std::regex_match("st", r) << std::endl; std::cerr << "st|mt|tr" << " matches mt? " << std::regex_match("mt", r) << std::endl; std::cerr << "st|mt|tr" << " matches tr? " << std::regex_match("tr", r) << std::endl; } outputs: st|mt

Why is C++ executable running so much faster when linked against newer libstdc++.so?

陌路散爱 提交于 2020-01-22 15:35:55
问题 I have a project (code here) in which I run benchmarks to compare the performance of different methods for computing dot product (Naive method, Eigen library, SIMD implementation, ect). I am testing on a fresh Centos 7.6 VM. I have noticed that when I use different versions of libstdc++.so.6 , I get significantly different performance. When I spin up a new Centos 7.6 instance, the default C++ standard library is libstdc++.so.6.0.19 . When I run my benchmark executable (linked against this

GCC 4.8 and char16_t streams - bug?

痞子三分冷 提交于 2020-01-16 05:28:12
问题 Is this a libstdc++ bug? #include <string> #include <sstream> using namespace std; int main() { basic_string<char16_t> str(u"0.0"); basic_stringstream<char16_t> sstr(str); double x = 9; sstr >> x; } Output, under GCC 4.8 Linux x86_64: $ ./main terminate called after throwing an instance of 'std::bad_cast' what(): std::bad_cast Aborted (core dumped) Edit Can someone suggest a way to make this function work under GCC 4.9 without changing its signature: template<typename T> T fromString(std:

Confusion while deriving from std::tuple, can not handle std::get

蓝咒 提交于 2020-01-13 08:42:26
问题 My basic idea was to derive my own class from std::tuple to get some helper types inside like this: template <typename ... T> class TypeContainer: public std::tuple<T...> { public: using BaseType = std::tuple<T...>; static const size_t Size = sizeof...(T); TypeContainer(T... args):std::tuple<T...>(args...){}; using index_sequence = std::index_sequence_for<T...>; }; Now I try to use the code as follows: using MyType_tuple_with_empty = std::tuple< std::tuple<float,int>, std::tuple<>, std::tuple

OS X program runs on dev machine, crashing horribly on others

a 夏天 提交于 2020-01-12 07:29:06
问题 I have an OS X 10.6 Mac I'm using as my dev machine. The program I wrote works perfectly on the dev machine. However, when I tried to run it on an OS X 10.5 (not sure if that's relevant) test machine, it crashes on launch. This is the error I'm getting: Process: MyApp[25908] Path: /Applications/MyApp.app/Contents/MacOS/MyApp Identifier: MyApp Version: ??? (???) Code Type: X86 (Native) Parent Process: launchd [109] Interval Since Last Report: 17392106 sec Crashes Since Last Report: 735 Per-App

Mixing stdc++ and libc++ in an iOS project

纵饮孤独 提交于 2020-01-11 09:32:08
问题 I am having a difficult time configuring an iOS project which uses a static library linked against the old libstdc++ that gcc used. That library is 32 and 64-bit. There are 6 libraries (libssl.a for example) that are 32-bit and must be updated. If I compile those libraries from source, they will be automatically linked with libc++, which will result in my linker complaining. Therefore, here are my questions: 1) Is there any way to have a single static library inside the project use libstdc++,

Should I use libc++ or libstdc++? [closed]

对着背影说爱祢 提交于 2020-01-09 05:58:27
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . 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++? 回答1: I would use the native library for each OS i.e. libstdc++ on GNU/Linux and libc++ on Mac OS X. libc++ is not 100