Attention

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

P4016

Code

P4016

Message

Function declaration name is duplicated

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

Example

The following code will generate error P4016:

FUNCTION MyFunction : INT
END_FUNCTION

FUNCTION MyFunction : INT  (* Error: Duplicate function name *)
END_FUNCTION

The function MyFunction is declared twice, which is not allowed.

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

FUNCTION MyFunction1 : INT
END_FUNCTION

FUNCTION MyFunction2 : INT  (* Correct: Different name *)
END_FUNCTION