5

I am now currently working on a C++ project, which I wish to use C++11 features with. In this project, I am using the library NTL which is used for number theory stuff. Due to comfort auto completes Xcode has, I write my code with Xcode and the library NTL is statically linked with flag "-lntl".

Now, I wish to use some C++11 features. Apple's LLVM compiler that is default in Xcode includes such support, but somehow compiling with NTL and iostream doesn't work, unlike with the LLVM GCC 4.2 compiler with Xcode.

And so, I use LLVM GCC 4.2 compiler, but it does not include support for C++11. Therefore, I brew'd gcc48, and I wish now to make Xcode compile its code with gcc4.8.

How can I do that?

--EDIT--
Solved thanks to all comments which advised to change from libc++ to stdlibc++ (GNU libc++) and that solved the problem of NTL not being compiled with Clang.

Sergey K.
  • 24,894
  • 13
  • 106
  • 174
Edgepo1nt
  • 303
  • 2
  • 13
  • How did you install NTL? Have you tried recompiling it using clang? – Xymostech Mar 28 '13 at 15:49
  • No. You suggest that this should solve the awkward problem which clang did not compile the project with NTL correctly? – Edgepo1nt Mar 28 '13 at 15:53
  • 1
    Xymostech is right, I think you should try to resolve compiling errors rather than integrating gcc48 into XCode, it will be less pain and less problems in future. It would be nice if you'll include compile errors to the question. – cody Mar 28 '13 at 16:00
  • Yes, I think that could help. Because gcc's `stdlibc++` and clang's `libc++` are incompatible with each other, things like `std::iostream` don't work if both are used at the same time. – Xymostech Mar 28 '13 at 16:01
  • 1
    It's also entirely possible to compile with GNU `stdlibc++` using `Clang` - binary compatibility being the main reason you'd want to. – marko Mar 28 '13 at 16:10
  • Cheers Marko! Changed to GNU's stdlibc++ instead of libc++ of Clang, and now compiles with NTL. Thanks! – Edgepo1nt Mar 28 '13 at 16:26
  • 6
    **Dammit people it's called libstdc++ not stdlibc++** – Jonathan Wakely May 23 '13 at 12:20
  • You should change your edit to an answer to your own question and accept it. – miguel.martin Aug 19 '13 at 11:00

1 Answers1

1

There are 2 different implementation of C++ run-time library: gcc's libstdc++ and clang's libc++ which are incompatible with each other.

Change the use from libc++ to libstdc++.

Sergey K.
  • 24,894
  • 13
  • 106
  • 174