libc++

Difference in stringstream behavior for void* type using libc++ and libstdc++

自古美人都是妖i 提交于 2019-12-01 04:25:46
The following test program returns different results depending on whether I'm using libc++ or libstdc++. #include <sstream> #include <iostream> int main() { int a = 0; void* optr = &a; void* iptr; std::stringstream ss; ss << optr; std::cout << ss.str() << '\n'; ss >> iptr; std::cout << iptr << '\n'; return 0; } I'm using the following version of clang from Xcode 5 on OSX 10.9.2 $ xcrun clang++ --version Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix Here's the output of the test when built with libstdc++ and libc++ $ xcrun

Link different C++ standard libraries on Mac OS X

别来无恙 提交于 2019-11-30 18:39:54
Now that multiple C++ standard libraries can exist on Mac OS X, it now looks like quite a chaotic situation. According to https://stackoverflow.com/a/8457799/1772681 , mixing libstdc++ and libc++ will result in link error, which catches such dangerous situation and is a good thing. On the other hand, There are still 2 situations need more investigation, and I have created a few test cases for this in github gist ( https://gist.github.com/manphiz/7195515 ). It confirms that mixing dynamic libraries that link to libstdc++ (either from system or vanilla GNU GCC) and libc++ (system) will result in

clang++ -stdlib=libc++ leads to undefined reference

痴心易碎 提交于 2019-11-30 13:10:31
Why am I getting the following linker error when using clang with libc++: $ clang++ -stdlib=libc++ po.cxx -lpoppler /tmp/po-QqlXGY.o: In function `main': po.cxx:(.text+0x33): undefined reference to `Dict::lookup(char*, Object*, std::__1::set<int, std::__1::less<int>, std::__1::allocator<int> >*)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Where: $ nm -D /usr/lib/x86_64-linux-gnu/libpoppler.so | grep lookup | c++filt| grep \ Dict::lookup\( 00000000000c1870 T Dict::lookup(char*, Object*, std::set<int, std::less<int>, std::allocator<int> >*) Code is simply:

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

廉价感情. 提交于 2019-11-30 06:32:33
问题 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. 回答1: Clean the project. Check each constraints and remove the corrupted one. Clean project again, it should works. 回答2: I got the same error and a "clean" didn't resolve it. It was caused

Link different C++ standard libraries on Mac OS X

萝らか妹 提交于 2019-11-30 03:16:27
问题 Now that multiple C++ standard libraries can exist on Mac OS X, it now looks like quite a chaotic situation. According to https://stackoverflow.com/a/8457799/1772681, mixing libstdc++ and libc++ will result in link error, which catches such dangerous situation and is a good thing. On the other hand, There are still 2 situations need more investigation, and I have created a few test cases for this in github gist (https://gist.github.com/manphiz/7195515). It confirms that mixing dynamic

Xcode 4.2 + c++0x/libc++ cannot find iostream

a 夏天 提交于 2019-11-29 22:14:49
问题 I'm using Macbook 1g, Snow Leopard. Few days ago i installed xcode 4.2 and made a test project for c++0x. I set LLVM 3.0 as c++ compiler, C++ Language Dialect as C++0x and C++ Standard Library as libc++. but when building, error occured. "iostream" file not found I find it most bewildering. How can I solve this problem? 回答1: "I changed libc++ to libstdc++". How? Where is this setting? Apple documentation says "simply set "C++ Standard Library Type" in the build settings to ... " Build

Printing/Debugging libc++ STL with XCode/LLDB

雨燕双飞 提交于 2019-11-29 19:37:18
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 anything. Has anyone been able to get any useful output from LLDB with libc++?? Jim Ingham [] is an

clang++ -stdlib=libc++ leads to undefined reference

纵然是瞬间 提交于 2019-11-29 18:41:17
问题 Why am I getting the following linker error when using clang with libc++: $ clang++ -stdlib=libc++ po.cxx -lpoppler /tmp/po-QqlXGY.o: In function `main': po.cxx:(.text+0x33): undefined reference to `Dict::lookup(char*, Object*, std::__1::set<int, std::__1::less<int>, std::__1::allocator<int> >*)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Where: $ nm -D /usr/lib/x86_64-linux-gnu/libpoppler.so | grep lookup | c++filt| grep \ Dict::lookup\( 00000000000c1870

Does std::map require the comparator's operator() to be const?

折月煮酒 提交于 2019-11-29 09:19:26
The following code fails to compile with XCode 4.5's clang++ when using libc++ on OS X 10.8: #include <map> #include <string> class Foo { public: explicit Foo(int val_) : val(val_) {} int val; }; struct FooComparator { bool operator()(const Foo& left, const Foo& right) { return left.val < right.val; } }; int main(int argc, char* argv[]) { std::map<Foo, std::string, FooComparator> m; Foo f(4); m[f] = std::string("four"); return 0; } The error: broken.cpp:11:8: note: candidate function not viable: 'this' argument has type 'const FooComparator', but method is not marked const bool operator()

In Xcode 4.5, what is “Compiler Default” for “C++ Standard Library” and “C++ Language Dialect”?

大城市里の小女人 提交于 2019-11-29 05:38:15
问题 What is the value of "Compiler Default" for "C++ Standard Library" and "C++ Language Dialect" in Xcode 4.5? My guess is libstdc++ and GNU++98, but it would be nice to have clarification. From the Xcode 4.5 release notes: Projects created using this Xcode release use the new libc++ implementation of the standard C++ library. The libc++ library is available only on iOS 5.0 and later and OS X 10.7 and later. 12221787 To enable deployment on earlier releases of iOS and OS X in your project, set