分享

ios开发常见编译告警

 叹落花 2015-06-05

1、 implicit declaration of function `sleep'

#inlude<unistd.h>

 

2、 implicit declaration of function ‘malloc’

#include<stdlib.h>

3、 implicit declaration of function `memcpy'

#include <string.h>

4、 implicit declaration of function ` inet_addr’

#include <sys/socket.h>

#include <netinet/in.h>

#include <arpa/inet.h>  // 经常是少加了一个文件,然后导致了大量的告警。



5、 suggest parentheses around assignment used as truth value

=改成==

6、 Multiple definition of

将变量声明放到.c


GCC的设定,可以改变GCC编译的代码。

C Language Dialect

GCC_C_LANGUAGE_STANDARD = C89

(C99 permitted if absolutely necessary, especially on iOS)
Choose a standard or non-standard C language dialect.

  • ANSI C:
    Accept ISO C90 and ISO C++, turning off GNU extensions that are incompatible. [-ansi]?
    Incompatible GNU extensions include the ‘asm’, ‘inline’, and ‘typeof’ keywords? (but not the equivalent __asm__, __inline__, and __typeof__ forms), and the ‘//’ syntax for comments.?
    This setting also enables trigraphs.
  • C89:
    Accept ISO C90, but not GNU extensions. [-std=c89]
  • GNU89:
    Accept ISO C90 and GNU extensions. [-std=gnu89]
  • C99:
    Accept ISO C99, but not GNU extensions. [-std=c99]
  • GNU99:
    Accept ISO C99 and GNU extensions. [-std=gnu99]
  • Compiler Default:
    Tells the compiler to use its default C language dialect. This is normally the best choice unless you have specific needs. (Currently equivalent to GNU89.)

Please see the full GCC manual for the full definition of all these settings on the C dialect:?


ios4.1SDK之后,NSString和char的转换,不推荐使用cString函数了


NSString *str = [NSString alloc]initWithFormat:@“thisis%d”,i];


const char * p_ch = [str UTF8String];


const char * p_ch = [ str cString] ; //对于ios4平台会提示告警。并不再建议使用了。

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多