Initializer element is not a compile-time constant

Posted lijianyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Initializer element is not a compile-time constant相关的知识,希望对你有一定的参考价值。

话不多说,直接上图:

 

技术图片

 

发现CGSizeMake时直接报错, 但是直接赋值就可以,这是因为初始化一个全局变量或static变量时,只能用常量赋值,不能用变量赋值!

 

以上是关于Initializer element is not a compile-time constant的主要内容,如果未能解决你的问题,请参考以下文章

C语言malloc编译报错:initializer element is not constant(不能将全局变量初始化为一个无法在编译时期确定的值)

spring “The matching wildcard is strict, but no declaration can be found for element”报错原

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element

Cannot open include file: 'initializer_list': No such file or directory

使用“if $(element).is(...)”检查数组元素

关于报错stale element reference: element is not attach