libc++

How to build OpenCV for Android using libc++ STL library?

↘锁芯ラ 提交于 2020-01-02 11:29:52
问题 I would like to build a OpenCV from source using a libc++ STL library, instead of default GNU STL. LibC++ offers better C++11 and C++14 support. Is it possible to do that? 回答1: I've tested this with OpenCV 2.4.7 and Android NDK r10d. First, you need to download OpenCV source. Unpack the source and replace the platforms/android/android.toolchain.cmake with version that suppports libc++. Now, open modules/core/include/opencv2/core/operations.hpp and change line 69 from (defined __GNUC__ &&

Customising std::shared_ptr or boost::shared_ptr to throw an exception on NULL dereference

谁说我不能喝 提交于 2020-01-02 03:50:49
问题 I have a few projects that use boost::shared_ptr or std::shared_ptr extensively (I can convert to either implementation soon enough, if there is a good answer to this question for one, but not the other). The Boost implementation uses Boost.Assert to avoid returning in the case of encountering an empty (NULL) pointer in operator* or operator-> at runtime; while the libc++ implementation seems to lack any check. While of course the validity of a shared_ptr should be checked before use, a large

Checking for C++11 library features

有些话、适合烂在心里 提交于 2020-01-02 01:25:08
问题 What is a good way of checking for the presence of specific C++11 features of the standard library . For compiler features I just went by the way of checking the compiler version for the (IMHO) major compilers ( VC++ , gcc , clang at the moment, maybe Intel ) Although this is not the best and most flexible approach, I don't know of anything better yet, except for clang which has the really nice __has_feature macros. But it's even worse for library features, which are not coupled that rigidly

map with incomplete value type

妖精的绣舞 提交于 2019-12-29 01:37:30
问题 I'm getting an error with the following: class Test { std::map<std::string,Test> test; }; The error is "Field has incomplete type 'Test'". I read a few threads with suggested this might be a bug in the version of libcxx which ships with xcode, but it wouldn't surprise me at all if I just have to change it to: class Test { std::map<std::string,std::shared_ptr<Test>> test; }; I just wanted to double check that this is definitely a correct error and not a bug. Cheers! 回答1: The standard requires

compiling libc++ with clang++ in Ubuntu

我们两清 提交于 2019-12-24 09:49:39
问题 My OS is Ubuntu-11.04 i compiled llvm with clang as per the user manual successfully. then i tried to compile libcxx with clang++, i made modifications to the $LIBCXX_DIR/lib/buildit.sh by reading the following http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013228.html The modified file $LIBCXX_DIR/lib/buildit is pasted after the error message. with the modified buildit.sh i get following errors. It seems clang++ is unable to compile the header file 'string' successfully. Here is

[LLVM-9 clang-9 OSX]: std::filesystem::path unrecognized

99封情书 提交于 2019-12-24 07:53:12
问题 Hello after upgrading on OSX Mojave to the version LLVM-9 using brew upgrade llvm I got the following error: In file included from /Users/roman/CLionProjects/Milerius/antara-gaming-sfml-template/cmake-build-debug/_deps/antara-gaming-sdk-src/modules/core/antara/gaming/core/real.path.cpp:17: /Users/roman/CLionProjects/Milerius/antara-gaming-sfml-template/cmake-build-debug/_deps/antara-gaming-sdk-src/modules/core/antara/gaming/core/real.path.hpp:23:22: fatal error: 'path' is unavailable:

Link problems with libc++abi when linking against libc++ via cmake

吃可爱长大的小学妹 提交于 2019-12-23 20:24:40
问题 I'm trying to build a simple ("hello world") C++ program with LLVM/Clang 3.7.0 built from sources against the toolchain's libc++ , with the command line: clang++ -std=c++14 -stdlib=libc++ -fno-exceptions hello.cpp However, I get the following errors: /usr/bin/ld: warning: libc++abi.so.1, needed by /bulk/workbench/llvm/3.7.0 /toolchain4/bin/../lib/libc++.so, not found (try using -rpath or -rpath-link) /bulk/workbench/llvm/3.7.0/toolchain4/bin/../lib/libc++.so: undefined reference to `__cxa

Why does libc++ getline block when reading from pipe, but libstdc++ getline does not?

好久不见. 提交于 2019-12-23 10:06:30
问题 TL;DR A program that uses the libc++ version of the getline function will block when it reads input from a pipe until the pipe's buffer is full. The same is NOT true for the libstdc++ version of the getline function: Here the function immediately reads and returns a line of input as soon as it becomes available. Should I expect this difference in behaviour between libstdc++ and libc++ ? [ EDIT: I am not fishing for an opinion here, I simply don't know enough about pipes nor the difficulties

Debug issues with libc++ in Xcode 4.4

风流意气都作罢 提交于 2019-12-23 09:42:15
问题 I am having a problem when I try to debug on a list iteration on c++. I made a simple test app: int main(int argc, const char * argv[]) { // insert code here... std::cout << "Hello, World!\n"; std::list<int> list; list.push_back(1); list.push_back(2); --> list.push_back(3); //Line before step over for (std::list<int>::const_iterator i = list.begin(); i != list.end(); i++) { std::cout << *i << std::endl; } return 0; } While debugging, when I am on the line marked with an arrow, when I step

C++11 standard libraries in libstdc++ on Mac

浪子不回头ぞ 提交于 2019-12-23 02:02:13
问题 In a Xcode project which I currently work on, I am using C++11 with Apple LLVM 4.2 (clang) compiler, and using libstdc++ as my standard library, because I am using a library (NTL) which was not compiled with libc++ and so I must use libstdc++. When writing the following code: #include <regex> int main() { return 0; } It doesn't compile, by saying: 'regex' file not found And so I can't use any C++11 library with my libstdc++ (Tried <mutex> , <thread> aswell). Another I tried to take is to