libc++

Compiling with Clang using Libc++ undefined references

让人想犯罪 __ 提交于 2019-11-28 21:10:03
The first couple are too long to reference. I get this error when I try to compile clang++ -stdlib=libc++ ../main.cc ... with clang and libc++ from the SVN. error: undefined reference to 'typeinfo for char const*' error: undefined reference to '__cxa_allocate_exception' error: undefined reference to '__cxa_throw' /tmp/cc-pbn00y.o:../main.cc:function std::__1::deque<double, std::__1::allocator<double> >::__add_back_capacity(): error: undefined reference to '__cxa_begin_catch' /tmp/cc-pbn00y.o:../main.cc:function std::__1::deque<double, std::__1::allocator<double> >::__add_back_capacity(): error

libc++abi.dylib: terminate_handler unexpectedly threw an exception - 0 stack trace iOS7 / iOS 8

两盒软妹~` 提交于 2019-11-28 20:53:31
Randomly (that's why I ask the question), my application crashes when want to display data into textView. The only error message I've got in my debug console is : libc++abi.dylib: terminate_handler unexpectedly threw an exception I Googled but can't get a clue to find how correct this and how this happens. Clean the project. Check each constraints and remove the corrupted one. Clean project again, it should works. Sean Dev I got the same error and a "clean" didn't resolve it. It was caused by my internet testing flow, I check to see if WiFi is connected but not if that WiFi has an active

Printing/Debugging libc++ STL with Xcode/LLDB

对着背影说爱祢 提交于 2019-11-28 15:20:33
问题 I'm trying to use LLDB within Xcode 8 to debug very basic STL. I used to be able to print a vector like this: p myvector[0] to see whatever was in the first vector index. Now when I do that, I get this error: error: Couldn't lookup symbols: __ZNSt3__16vectorI9my_classNS_9allocatorIS1_EEEixEm Instead, I have to type this: p myvector.__begin_[0] in order to get any output. I tried importing the libcxx.py and unordered_multi.py scripts from the LLDB svn repository but that doesn't seem to change

std::istream operator exception reset / not thrown

巧了我就是萌 提交于 2019-11-28 13:58:03
I'm not sure about how to use std::istream::exception according to the standard , to let std::istream::operator>> throw an exception if it can't read the input into a variable, e.g. double. The following code has different behavior with clang/libc++ and gcc/libstdc++: #include <iostream> #include <cassert> int main () { double foo,bar; std::istream& is = std::cin; is.exceptions(std::istream::failbit); is >> foo; //throws exception as expected with gcc/libstdc++ with input "ASD" std::cout << foo; is >> bar; std::cout << bar; assert(is); //failed with clang/libc++ after input "ASD" std::cout <<

What Effect Would LWG2349 Have?

家住魔仙堡 提交于 2019-11-28 13:35:12
While libstdc++ does not, libc++ does follow the standard which states that passing ios_base::failbit to basic_istream::exceptions has no effect on formatted input. For example this code: istringstream is{"ASD"}; double foo; is.exceptions(istream::failbit); try { is >> foo; cout << foo << endl; } catch(ios_base::failure& fail) { cout << "ouch\n"; } Would result in: "ouch" on libstdc++ "0" on libc++ My reading of LWG2349 is that it would cause basic_istream to not throw on any formatted input. For example LWG2349 proposes a change to the standard's 27.7.2.3 [istream]/1 which was cited with

Discrepancy between istream's operator>> (double& val) between libc++ and libstdc++

你离开我真会死。 提交于 2019-11-28 12:11:40
With my recent upgrade to Mac OS X 10.9 the default standard C++ library changed from libstdc++ to libc++. Since then I observe unexpected behaviour of the stringstream operator>>(double) documented in the code example below. In summary the libc++ seems to have problems with extracting double values from stringstreams when the double value is followed by a letter. I already checked the standard (2003) but I can't find any specific information if extraction should work in this case or not. So I would be grateful for any input whether this is a bug in libc++ or libstdc++. #include <sstream>

libc++ - stop std renaming to std::__1?

為{幸葍}努か 提交于 2019-11-28 12:05:14
After substantial effort getting clang and libc++ to compile, run, integrate with NetBeans, and even cross-compile to a 32-bit machine, I thought I had it all figured out! So I go to use some features that libstdc++ didn't have (the entire reason for turning my dev environment upside down), and discover... I can't actually do that. libc++ is installed, it works, and the compiled program (when it works) does require it. However, the compiler still tries to use libstdc++ versions at every opportunity, by messing with the namespace; std::__1::map , std::__1::basic_string , and so on. Now, I know

Why the libc++ std::vector internally keeps three pointers instead of one pointer and two sizes?

和自甴很熟 提交于 2019-11-28 10:49:51
I'm looking at the implementation of std::vector in libc++ and I noticed that it internally keeps three pointers (one to the begin, one the end, and one to the end of the allocated memory) instead of what I'd instinctively do, i.e., one pointer to the begin and two size and capacity members. Here is the code from libc++'s <vector> (ignore the compressed pair, I know what it means). pointer __begin_; pointer __end_; __compressed_pair<pointer, allocator_type> __end_cap_; I noticed that also other standard libraries do the same (e.g. Visual C++). I don't see any particular reason why this

Is make_shared really more efficient than new?

倖福魔咒の 提交于 2019-11-27 17:41:34
I was experimenting with shared_ptr and make_shared from C++11 and programmed a little toy example to see what is actually happening when calling make_shared . As infrastructure I was using llvm/clang 3.0 along with the llvm std c++ library within XCode4. class Object { public: Object(const string& str) { cout << "Constructor " << str << endl; } Object() { cout << "Default constructor" << endl; } ~Object() { cout << "Destructor" << endl; } Object(const Object& rhs) { cout << "Copy constructor..." << endl; } }; void make_shared_example() { cout << "Create smart_ptr using make_shared..." << endl

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

喜你入骨 提交于 2019-11-27 17:22:21
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++? Jonathan Wakely 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% complete on GNU/Linux, and there's no real advantage to using it when libstdc++ is more complete. Also, if you want to link to any other libraries written in C++ they will almost certainly have been built with libstdc++ so you'll need to link with that too to use them. More info here about the completeness of