P2013

Code

P2013

Message

Array element type is not declared

This error occurs when an array declaration references an element type that has not been declared.

Example

The following code will generate error P2013:

TYPE
    DataArray : ARRAY[1..10] OF UndeclaredElementType;  (* Error: Element type not declared *)
END_TYPE

The array DataArray references UndeclaredElementType as its element type, but this type has not been declared.

To fix this error, declare the element type first:

TYPE
    ElementType : INT;
    DataArray : ARRAY[1..10] OF ElementType;  (* Correct: Element type declared *)
END_TYPE

Alternatively, use a built-in type:

TYPE
    DataArray : ARRAY[1..10] OF INT;  (* Correct: INT is a built-in type *)
END_TYPE

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.