首页 > 移动平台 > 详细

iOS duplicate symbol 变量 in 类名 报错

时间:2016-12-19 10:46:17      阅读:275      评论:0      收藏:0      [点我收藏+]

该错误信息是我在一个.h文件里申明了公共变量,然后在其他类里重复使用。

Build Settings ->No Common Blocks默认为YES,编译器就报错了,需要修改Build Settings里的No Common Blocks为NO。

 

NO Common Blocks 是什么?

 官方的解释是:

    In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without extern ) in two different compilations, you will get an error when you link them. The only reason this might be useful is if you wish to verify that the program will work on other systems which always work this way.

    在C语言中,在目标文件的数据段分配甚至未初始化的全局变量,而不是生成它们作为公共块。这样做,如果同一个变量被声明(没有extern)放在两个不同的汇编,你会当你将它们链接得到一个错误的影响。这可能是有用的唯一原因是,如果你想验证程序将在其他系统上,它总是以这种方式工作工作。

iOS duplicate symbol 变量 in 类名 报错

原文:http://www.cnblogs.com/weiboyuan/p/6196345.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!