I'm trying to build the project for iOS. I can't use libc++ ( LLVM C++ standart library ). How to build a project using libstdc++ (NOT libc++) with C++11 support?
Asked
Active
Viewed 479 times
0
-
Select your project in Project navigator (cmd+1) -> Build settings -> type `c++` in search textbox, select 'C++ language dialect' -> C++11 – fnc12 Jun 22 '16 at 13:35
-
@fnc12, this doesn't work. **'tuple' file not found** (tuple added in c++11) – Jun 22 '16 at 13:48
-
1why can't you use `libc++` but `libstdc++`? – fnc12 Jun 22 '16 at 13:51
-
because some parts of the code are not building with libc++, but building with libstdc++. - @fnc12 – Jun 22 '16 at 13:57
-
This is weird. All your code must compile well with `libc++`. About your question look [here](http://stackoverflow.com/questions/10308167/when-enabling-c11-with-stdlibc-4-7-clang-error-out-while-gcc-compiles-fine). Probably you'll find solution there – fnc12 Jun 22 '16 at 13:59
-
1try `#include
` – fnc12 Jun 22 '16 at 14:00 -
It works with a tuple, but not with the mutex. - @fnc12 – Jun 22 '16 at 14:07
-
What's the version of your clang? Did you add `-std=c++11` in your compile command? – Mine Jun 22 '16 at 14:40
-
Apple LLVM version 7.3.0 (clang-703.0.31) Yes, I did. @Mine – Jun 22 '16 at 14:47
-
Can you post the output of `clang -v` and check what threading model it uses? Mine says `Thread model: posix` – Chris Beck Jun 23 '16 at 07:35
-
Thread model: posix - @ChrisBeck – Jun 23 '16 at 19:52
-
It says thread model: posix, but you can't `#include
`? That is indeed surprising... you might want to double check how the toolchain is built, or check with who provided it to you. Now I see why you want to switch to `libstdc++`, (although it still might not work?) – Chris Beck Jun 23 '16 at 19:53 -
I can use mutex, tuple with **libc++** (because it supports C++11), but I can't use C++11 extensions (tuple, mutex...) with **libstdc++** library (because gcc 4.2.1 not support C++11). Any ideas how to expand **libstdc++** to C++11? - @ChrisBeck – Jun 23 '16 at 20:15
-
You need a more recent version of gcc, gcc 4.2.1 does not support C++11 at all, and I don't think using a later version of `libstdc++` will fix that. (That's probably not supported anyways, or a good idea.) You probably want at least `gcc 4.9`, you might be able to get away with `gcc 4.8`. – Chris Beck Jun 23 '16 at 20:18