Attention
IronPLC implements many parts of the IEC 61131-3 standard and is working toward full Structured Text support. Key features still missing include arrays and structures. Try it out in the IronPLC Playground.
P4032¶
- Code
P4032
- Message
Constant referenced in type parameter has no initializer
This error occurs when a constant name is used in a type parameter (such as a STRING length or array bound) but the referenced constant does not have an initializer value.
Example¶
The following code will generate error P4032:
VAR_GLOBAL CONSTANT
MAX_LEN : INT;
END_VAR
FUNCTION_BLOCK MyFB
VAR_INPUT
name : STRING[MAX_LEN];
END_VAR
END_FUNCTION_BLOCK
The constant MAX_LEN is declared without a value. To fix this error, provide an initializer:
VAR_GLOBAL CONSTANT
MAX_LEN : INT := 100;
END_VAR