zoukankan      html  css  js  c++  java
  • iOS duplicate symbol 变量 in 类名 报错

    该错误信息是我在一个.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)放在两个不同的汇编,你会当你将它们链接得到一个错误的影响。这可能是有用的唯一原因是,如果你想验证程序将在其他系统上,它总是以这种方式工作工作。

  • 相关阅读:
    为PHP开发C语言扩展
    为PHP开发C++扩展
    PHP 7 vs HHVM性能对比
    Real-time storage area network
    JS书写优化
    JS书写优化
    数据库 10 大常见安全问题盘点~
    数据库 10 大常见安全问题盘点~
    数据库 10 大常见安全问题盘点~
    SQL Server 数据库定时自动备份
  • 原文地址:https://www.cnblogs.com/weiboyuan/p/6196345.html
Copyright © 2011-2022 走看看