Xcode warning:...是一个GNU扩展 [英] Xcode warning: ... is a GNU extension

查看:251
本文介绍了Xcode warning:...是一个GNU扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为iOS应用程式使用C ++程式库。使用Apple LLVM 3.1编译器配置(默认),我得到了这个C ++代码的很多警告,大多数人说:

I use a C++ library for an iOS app. With Apple LLVM 3.1 compiler configured (default), I get a lot of warnings for this C++ code, most of them saying:

... is a GNU extension

clang的用户手册介绍:
Clang驱动程序和语言特性被有意设计为与GNU GCC编译器尽可能兼容,从而简化从GCC到Clang的迁移。在大多数情况下,代码只是工作。

The introduction of clang's user manual says: The Clang driver and language features are intentionally designed to be as compatible with the GNU GCC compiler as reasonably possible, easing migration from GCC to Clang. In most cases, code "just works".

因此,它是保存只是寻找一个开关禁用此警告(btw。 )或者我应该更好地得到这个lib摆脱所有GNU扩展?

So, is it save to just look for a switch to disable this warnings (btw. how to?) or should I better get this lib rid of all GNU extensions?

推荐答案

可以使用编译器标记抑制警告。 Clang告诉你每个警告使用哪个编译器标志。构建后,选择视图>导航器>显示日志导航器。然后从日志导航器中选择最新的构建日志。查找带有警告的文件,然后单击其状态行右侧的公开按钮。 Xcode将显示该文件的编译器命令行和输出。每个警告都应包含启用警告的编译器标志。示例:

You can suppress the warnings using compiler flags. Clang tells you which compiler flag to use for each warning. After a build, choose View > Navigators > Show Log Navigator. Then choose the latest build log from the log navigator. Find a file with a warning and click the disclosure button at the right end of its status line. Xcode will show you the compiler command line and output for that file. Each warning should include the compiler flag that enables the warning. Example:

>

在我的示例中,警告标志是 -Wpointer-arith 。因此, -Wno-pointer-arith 可以禁用。因此,我可以将该标志添加到其他警告标志构建设置:

In my example, the warning flag is -Wpointer-arith. So the warning can be disabled by -Wno-pointer-arith. So I could add that flag to the "Other Warning Flags" build setting:

这篇关于Xcode warning:...是一个GNU扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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