需要常量表达式Constant expression is required

Const 语句没有正确初始化常量,或数组声明使用了变量来指定元素数。A Const statement does not properly initialize a constant, or an array declaration uses a variable to specify the number of elements.

错误 ID: BC30059Error ID: BC30059

更正此错误To correct this error

  1. 如果该声明是 Const 语句,请检查以确保常量被初始化为文本、以前声明的常量、枚举成员,或结合了运算符的文本、常量和枚举成员的组合。If the declaration is a Const statement, check to make sure the constant is initialized with a literal, a previously declared constant, an enumeration member, or a combination of literals, constants, and enumeration members combined with operators.

  2. 如果该声明指定数组,请检查是否正在使用变量指定元素的数量。If the declaration specifies an array, check to see if a variable is being used to specify the number of elements. 如果是,请用常量表达式替换该变量。If so, replace the variable with a constant expression.

另请参阅See also