对于在 .pch 文件中导入的 C 函数,Xcode 产生警告“函数 N 的隐式声明在 C99 中无效”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14267741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode produces warnings 'Implicit declaration of function N is invalid in C99' for C functions imported in .pch file
提问by Stanislav Pankevich
Unlike the behavior described in this SO topic: xCode 4.4 does not get all the .pch file headers imports?, my project does builds successfully, but anyway I see these annoying yellow highlights Xcode gives me in its editors.
与此 SO 主题中描述的行为不同:xCode 4.4 没有获取所有 .pch 文件头导入?,我的项目确实成功构建,但无论如何我看到 Xcode 在其编辑器中给我的这些烦人的黄色亮点。
How can I teach Xcode to pick up .pch-file headers imports or is this a buggy behavior?
我如何教 Xcode 获取 .pch-file 头文件导入或者这是一个错误的行为?
采纳答案by Stanislav Pankevich
This is very strange, but after restarting Xcode and cleaning build folder (just one more command+alt+shift+K in response to @Matthias comment) warnings have gone.
这很奇怪,但是在重新启动 Xcode 并清理构建文件夹后(针对@Matthias 的评论,只需再执行一个 command+alt+shift+K)警告就消失了。
I say 'strange' because I did see them for about a week (after I had extracted a couple of small utility C functions as a Cocoa Pod and had begun importing them in my .pch-file).
我说“奇怪”是因为我确实看到它们大约一个星期(在我提取了几个小的实用程序 C 函数作为 Cocoa Pod 并开始将它们导入我的 .pch 文件之后)。
I will provide more details here, if I ever see this behavior again and notice any details about how it can occur.
如果我再次看到这种行为并注意到有关它如何发生的任何细节,我将在此处提供更多详细信息。
回答by aroragourav
I fixed it by adding #include <arpa/inet.h> in .pch file of my xcode project
我通过在我的 xcode 项目的 .pch 文件中添加 #include <arpa/inet.h> 来修复它