Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

P2012

Code

P2012

Message

Alias parent type is not declared

This error occurs when a type alias references a parent type that has not been declared.

Example

The following code will generate error P2012:

TYPE
    TypeAlias : UndeclaredType;  (* Error: UndeclaredType is not declared *)
END_TYPE

The type alias TypeAlias references UndeclaredType which has not been declared.

To fix this error, declare the parent type before creating the alias:

TYPE
    ParentType : INT;
    TypeAlias : ParentType;  (* Correct: ParentType is now declared *)
END_TYPE

Alternatively, use a built-in type:

TYPE
    TypeAlias : INT;  (* Correct: INT is a built-in type *)
END_TYPE