Attention

IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.

P2007

Code

P2007

Message

Type declaration name is duplicated

This error occurs when a type declaration name is duplicated within the same scope.

Example

The following code will generate error P2007:

TYPE
    the_struct : STRUCT
        member: BOOL;
    END_STRUCT;
    the_struct : STRUCT  (* Error: Duplicate type name *)
        member: BOOL;
    END_STRUCT;
END_TYPE

The type the_struct is declared twice within the same TYPE block, which is not allowed.

To fix this error, ensure all type names are unique within their scope:

TYPE
    the_struct : STRUCT
        member: BOOL;
    END_STRUCT;
    another_struct : STRUCT  (* Correct: Different name *)
        member: BOOL;
    END_STRUCT;
END_TYPE