Skip to main content

Compiler Error C0097

Message: Duplicate definition of variable '<variable name>' in function block '<function block name>' and in base '<base function block name>'

Possible error cause: A variable is declared with the same name in a function block and its base.

Error correction: Use different variable names.

Example 377. Example of the error:
PROGRAM PLC_PRG
VAR
    fb : FB;
END_VAR


FUNCTION_BLOCK FB EXTENDS FB2
VAR
    i : INT;
END_VAR


FUNCTION_BLOCK FB2
VAR
    i : INT;
END_VAR

Message:

C0097: Duplicate definition of variable 'i' in function block 'FB' and in base 'FB2'