Compiler Error C0576

Message: Cannot access VAR_INST '<variable name>' of '<method name>' from outside the declaring method

Possible error cause: An attempt is made to access a VAR_INST variable outside of declaring method.

Error correction: Remove the incorrect statement or change the declaration of the variable to be accessed (instead: VAR_INST for a method, VAR_INPUT for a function block).

Example of the error:

FUNCTION_BLOCK FB_Test
...
METHOD TestMethod: BOOL
VAR_INST
      bInst:BOOL;
END_VAR

PROGRAM MAIN
VAR
      fbTest:FB_Test;
      bTest:BOOL;
END_VAR
bTest := fbTest.TestMethod.bInst;

Message:

C0576: Cannot access VAR_INST 'bInst' of 'TestMethod' from outside the declaring method