ios Xcode 4.2 - '...' 的声明在此函数警告之外不可见
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7765484/
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 4.2 - declaration of '...' will not be visible outside of this function warning
提问by Sergnsk
I use Apple Reachability class from Apple Sample code Reachability
我使用 Apple 示例代码Reachability 中的Apple Reachability 类
in Xcode 4.2 and new Apple 3.0 compiler I get warning in this class that
在 Xcode 4.2 和新的 Apple 3.0 编译器中,我在这个类中收到警告
+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
declaration of 'struct sockaddr_in' will not be visible outside of this function*
“struct sockaddr_in”的声明在此函数之外不可见*
I am not good at classic C %) so I dont understand how I can fix this warning or may be I can ignore it at all.
我不擅长经典的 C %) 所以我不明白我该如何解决这个警告,或者我可以完全忽略它。
Thx
谢谢
回答by Saurabh
Add #import <netinet/in.h>
in Reachability.h to get away with this
添加#import <netinet/in.h>
Reachability.h 来解决这个问题