Skip to main content

Compiler Error C0141

Message: Reference assign needs variable with write access

Possible error cause: A constant is assigned to the reference assignment.

Error correction: Assign a writable variable.

Example 398. Example of the error:
PROGRAM PLC_PRG
VAR
    i : INT;
    I_r : REFERENCE TO INT;
END_VAR

I_r REF= 314;

Message:

C0141: Reference assign needs variable with write access

Error correction:

I_r REF= i;