ios开发常见编译告警

gcc编译常见问题解决方法

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平台会提示告警。并不再建议使用了。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值