P2008

Code

P2008

Message

Cannot determine kind of type identifier

This error occurs when a type is referenced that has not been declared.

Example

The following code will generate error P2008:

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

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.