Skip to main content

Compiler Error C0140

Message: Reference assign is only allowed to variables of Reference type

Possible error cause: An attempt is made to assign a reference value to a variable not defined as a reference type.

Error correction: Define the variable as a reference type.

Example 397. Example of the error:
PROGRAM PLC_PRG
VAR
    i : INT;
    I_r : INT;
END_VAR

I_r REF= i;

Message:

C0140: Reference assign is only allowed to variables of Reference type

Error correction:

I_r : REFERENCE TO INT;