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.

P4030

Code

P4030

Message

Constant referenced in type parameter is not defined

This error occurs when a constant name is used in a type parameter (such as a STRING length or array bound) but no matching VAR_GLOBAL CONSTANT declaration can be found.

Example

The following code will generate error P4030:

FUNCTION_BLOCK MyFB
VAR_INPUT
    name : STRING[UNDEFINED_CONST];
END_VAR
END_FUNCTION_BLOCK

The constant UNDEFINED_CONST is not declared anywhere. To fix this error, declare the constant:

VAR_GLOBAL CONSTANT
    UNDEFINED_CONST : INT := 100;
END_VAR

FUNCTION_BLOCK MyFB
VAR_INPUT
    name : STRING[UNDEFINED_CONST];
END_VAR
END_FUNCTION_BLOCK