constant expression required
时间: 2023-10-02 20:10:09 浏览: 123
在编译app时,出现"constant expression required"错误通常是因为在定义数组大小或在使用枚举类时,要求使用常量表达式作为大小或值。这意味着在编译时,必须将表达式求值为一个常数,而不能是变量或非常量表达式。这是因为在编译期间,需要确定数组的大小或枚举的值。如果你在定义数组大小或使用枚举类时遇到了这个错误,你需要确保所使用的表达式是一个常量表达式,而不是一个变量或非常量表达式。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [2021-09-17 Android 编译提示Constant expression required](https://blog.csdn.net/qq_37858386/article/details/120353011)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [c语言编译常见错误列表](https://download.csdn.net/download/lk123456sc/3804994)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Android enum Constant expression required问题解决](https://blog.csdn.net/weixin_42602900/article/details/129690552)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文