Xcode 7.1, Build Settings,No Common Blocks备忘

Xcode 7.1, Build Settings,No Common Blocks备忘

今天在项目里拖进了一个第三方SDK的源码,项目编译时fail,错误信息是duplicate symbols for architecture arm64。百度半天无果,只能询问SDK开发的小伙伴,告诉我需要修改Build Settings里的No Common Blocks为NO。No Common Blocks的Quick Help信息如下:

GCC_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. 
[GCC_NO_COMMON_BLOCKS, -fno-common]

原来是在这个SDK里有的头文件声明了公共变量,然后在另外几个文件里import了这个头文件,No Common Blocks默认为YES,编译器就报错了。

你可能感兴趣的:(iOS开发)