Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC 4.7/4.8 as Xcode's C/C++ Compiler

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.

like image 510
Edgepo1nt Avatar asked Nov 13 '22 08:11

Edgepo1nt


1 Answers

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++.

like image 65
Sergey K. Avatar answered Nov 15 '22 07:11

Sergey K.