码迷,mamicode.com
首页 > 其他好文 > 详细

欢迎使用CSDN-markdown编辑器

时间:2016-04-05 17:53:28      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:

XCode 编译程序时遇到的错误

1、Implicit declaration of function ‘inet_addr’ is invalid in C99

添加

#include <arpa/inet.h>

2、Implicit declaration of function ‘read’ is invalid in C99
Implicit declaration of function ‘write’ is invalid in C99
Implicit declaration of function ‘close’ is invalid in C99

相应的改为 fread,fwrite,fclose,对应函数的参数也要调整

3、Implicit declaration of function ‘access’ is invalid in C99
添加

#include <unistd.h>
#include <fcntl.h>

4、Implicit declaration of function ‘sign_extend’ is invalid in C99

在Linux Kernel 的源文件里有定义

static __inline int
sign_extend(int n, int num_bits)
{
  int shift = (int)(sizeof(int) * 8 - num_bits);
  return (n << shift) >> shift;
}

5、Cast from pointer to smaller type ‘unsigned int’ loses information

替换 为 uintptr_t

6、Implicit conversion loses integer precision: ‘long’ to ‘int’

7、ISO C++11 does not allow conversion from string literal to ‘char *’

void pig(char * input);
在 pig("This is a dog!");时会报上述错误
改为  void pig(const char *input);
或者调用时输入 pig((char *)"This is a dog!");

8、CodeSign error: code signing is required for product type ‘OCUnit Test Bundle’ in SDK ‘iOS 8.1’

Edit Scheme 的 build ,去掉 test 的选中

9、网络接口调用失败,提示”NSLocalizedDescription” “unsupported URL”

//在URL中如果包含汉字或特殊符号,需要转码到UTF8
    NSString *url = @"http://www.testcode.com/test/rest/messReceived?messag=content:{name:\"zhj\"}";
    url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
    NSLog(@"url %@",url);
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];

欢迎使用CSDN-markdown编辑器

标签:

原文地址:http://blog.csdn.net/xiaochunzao/article/details/51064610

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!