Attention

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

P2001

Code

P2001

Message

Structure has more than one element with name

This error occurs when a structure type declaration has duplicate element names.

Example

The following code will generate error P2001:

TYPE
    CustomStruct : STRUCT
        Name: BOOL;
        Name: BOOL;  (* Error: Duplicate element name *)
    END_STRUCT;
END_TYPE

The structure has two elements with the same name Name, which is not allowed.

To fix this error, ensure all element names in a structure are unique:

TYPE
    CustomStruct : STRUCT
        Name1: BOOL;
        Name2: BOOL;  (* Different name *)
    END_STRUCT;
END_TYPE