Skip to main content

Compiler Error C0018

Message: <expression> is not a valid assignment target

Possible error cause: An expression with no write permission is on the left side of an assignment. Example: a constant.

Error correction: Assign only to variables that have write access.

Example 324. Example of the error:
PROGRAM PLC_PRG
VAR
    i: INT;
END_VAR
VAR CONSTANT
    j: INT := 0;
END_VAR

j := i;

Message:

C0018: 'j' is no valid assignment target