Attention

These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.

P0010

Code

P0010

Message

Library has a recursive cycle

This error occurs when there is a recursive cycle in the library declarations, where items reference each other in a circular manner.

Example

The following code will generate error P0010:

FUNCTION_BLOCK SelfRecursive
VAR
    SelfRecursiveInstance : SelfRecursive;  (* Error: Self-reference creates cycle *)
END_VAR
END_FUNCTION_BLOCK

The function block SelfRecursive contains an instance of itself, creating a recursive cycle that cannot be resolved.

To fix this error, break the cycle by using a different approach:

FUNCTION_BLOCK Callee
VAR
    Input1: BOOL;
END_VAR
END_FUNCTION_BLOCK

FUNCTION_BLOCK Caller
VAR
    CalleeInstance : Callee;  (* Correct: No self-reference *)
END_VAR
END_FUNCTION_BLOCK