libstdc++

Using std::shared_ptr with clang++ and libstdc++

痴心易碎 提交于 2019-11-30 01:51:39
问题 I'm trying to use the std::shared_ptr in clang++(clang version 3.1 (trunk 143100)) using libstdc++(4.6.1). I have a little demo program: #include <memory> int main() { std::shared_ptr<int> some(new int); std::shared_ptr<int> other(some); return 0; } which can be build using: clang++ -std=c++0x -o main main.cpp and gives the following error output: main.cpp:6:23: error: call to deleted constructor of 'std::shared_ptr<int>' std::shared_ptr<int> other(some); ^ ~~~~ /usr/include/c++/4.6/bits

Avoid linking to libstdc++

安稳与你 提交于 2019-11-30 01:16:24
I'm working on an embedded project that currently uses C in Linux and uClibc. We're interested in moving it to C++, but I don't want the overhead associated with linking in libstdc++. My impression is that this is possible provided we don't use anything from STL, such as iostream or vector. How does one direct g++ to compile without linking to libstdc++? When you compile, use g++ -c to compile only. Then for linking, use ld instead of g++ . This invokes the linker directly, which requires you to name all your libraries on the command line (including libc and libcrt), however. Alternatively, if

error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64

荒凉一梦 提交于 2019-11-29 20:10:12
问题 I am trying to install Qt in my CentOS system. While building the library, I'm getting this error: /root/capture/qt-everywhere-opensource-src-4.7.0/bin/qmake: error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64 /root/capture/qt-everywhere-opensource-src-4.7.0/bin/qmake: error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64 回答1: It seems the softlink of the libstdc++.so.6 has been changed and is pointing to libstdc++.so.6.0.13 (64-bit?)

GDB error message (GCC 4.7) (from macports)

半世苍凉 提交于 2019-11-29 17:55:12
I have this kind of message when I start gdb : $ gdb a.out GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries . warning: Could not find object file "/opt/local/var

Static link libstdc++ using clang

僤鯓⒐⒋嵵緔 提交于 2019-11-29 12:43:03
问题 When I use GCC, I can build program on my Ubuntu 15.04 using this: -static-libgcc -static-libstdc++ And compiled binary can run on "stock" Ubuntu 14.04 without any external packages, only standard updates. Is there possibility do build with this static linking to library with clang ? Most common answers: using test ubuntu rep ( ppa:ubuntu-toolchain-r/test ) update server recompile on target server don't use GCC is not suitable for me. Just can I do this with clang for run it on Ubuntu 14.04.3

Segmentation fault in malloc_consolidate (malloc.c) that valgrind doesn't detect [duplicate]

戏子无情 提交于 2019-11-29 12:20:08
问题 This question already has answers here : Segfaults in malloc() and malloc_consolidate() (2 answers) Closed 3 years ago . My program goes in segmentation faults, and I cannot find the cause. The worst part is, the function in question does not always lead to segfault. GDB confirms the bug and yields this backtrace: Program received signal SIGSEGV, Segmentation fault. 0xb7da6d6e in malloc_consolidate (av=<value optimized out>) at malloc.c:5169 5169 malloc.c: No such file or directory. in malloc

Handling “dyld: lazy symbol binding failed: Symbol not found” error when nm does not find symbol

谁说胖子不能爱 提交于 2019-11-29 10:16:47
I have a fat (32- and 64-bit) Intel binary called myBinary that fails to run on another workstation running Mac OS X 10.8.2: $ myBinary dyld: lazy symbol binding failed: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_ Referenced from: /usr/local/bin/myBinary Expected in: /usr/lib/libstdc++.6.dylib dyld: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_ Referenced from: /usr/local/bin/myBinary Expected in: /usr/lib/libstdc++.6.dylib Trace/BPT trap: 5 I compiled it from a Mac OS X 10.8.2 workstation running GCC 4.7.2: $ gcc --version gcc (MacPorts gcc47 4.7.2_2

Why does g++ still require -latomic

纵饮孤独 提交于 2019-11-29 09:28:55
In 29.5 Atomic types of the C++ Standard November 2014 working draft it states: There is a generic class template atomic. The type of the template argument T shall be trivially copyable (3.9). [ Note: Type arguments that are not also statically initializable may be difficult to use. —end note ] So - as far as I can tell - this: #include <atomic> struct Message { unsigned long int a; unsigned long int b; }; std::atomic<Message> sharedState; int main() { Message tmp{1,2}; sharedState.store(tmp); Message tmp2=sharedState.load(); } should be perfectly valid standard c++14 (and also c++11) code.

How to build an application that requires both libstdc++.so.5 and libstdc++.so.6?

纵然是瞬间 提交于 2019-11-29 06:55:25
I want to preface this with the important notice that I am not a C/C++ programmer , and know very little about how linkage of libraries works in C. Our code uses libstdc++.so.6 (gcc 3.4, i think). We have third-party precompiled (closed source) libraries that use libstdc++.so.5 (gcc 2.something or 3.2, i think). This is on linux. We have both a .a and .so version of the third party lib. Is it possible to build our app with the 3rd party libs? How? Is it possible to build/run our app without having libstdc++.so.5 installed our our machines, how? If I've forgotten some critical information,

Debug through libstdc++

心已入冬 提交于 2019-11-29 06:32:00
I'm using gcc on GNU/Linux and the debug-files and headers of libc and libstd++ are installed. But I don't know how to tell gdb to use the source-code of them, especially to debug into libstd++. The source-code of libstdc++ itself seems to be provided in a complicated structure. I think the directory command is the right choice. I'm using here Debian/Ubuntu and downloaded the source with apt-get source libstdc++6 into my home-directory. I'm pretty sure I didn't need take special steps for this with Fedora (some years ago). Maybe Fedora was prepared in a special way for this. So I will be glad