GCC 4.7/4.8作为Xcode的C/C ++编译器 [英] GCC 4.7/4.8 as Xcode's C/C++ Compiler

查看:133
本文介绍了GCC 4.7/4.8作为Xcode的C/C ++编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事一个C ++项目,希望将其与C ++ 11功能一起使用.在这个项目中,我正在使用 NTL 库,该库用于数论材料. 由于Xcode具有自动完成功能,我使用Xcode编写了代码,并且库NTL与标志"-lntl"静态链接.

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

现在,我希望使用某些C ++ 11功能.在Xcode中默认使用的Apple LLVM编译器提供了这种支持,但是以某种方式无法使用NTL和iostream进行编译,与使用Xcode的LLVM GCC 4.2编译器不同.

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.

因此,我使用LLVM GCC 4.2编译器,但它不包括对C ++ 11的支持.因此,我酿造了gcc48,现在我希望使Xcode用gcc4.8编译其代码.

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?

-编辑-
感谢所有建议从libc ++更改为stdlibc ++(GNU libc ++)的注释,并解决了NTL无法用Clang编译的问题,从而解决了所有问题.

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

推荐答案

C ++运行时库有两种不同的实现:gcc的libstdc++和clang的libc++彼此不兼容.

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

将用途从libc++更改为libstdc++.

这篇关于GCC 4.7/4.8作为Xcode的C/C ++编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆