Attention
These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.
P0022¶
- Code
P0022
- Message
Unknown type
This error occurs when a type is referenced that has not been declared.
Example¶
The following code will generate error P0022:
FUNCTION_BLOCK Example
VAR
MyVar : UndeclaredType; (* Error: UndeclaredType is not declared *)
END_VAR
END_FUNCTION_BLOCK
The variable MyVar uses the type UndeclaredType which has not been declared anywhere in the program.
To fix this error, declare the type before using it:
TYPE
MyType : INT;
END_TYPE
FUNCTION_BLOCK Example
VAR
MyVar : MyType; (* Correct: MyType is now declared *)
END_VAR
END_FUNCTION_BLOCK