Skip to main content

Compiler Error C0549

Message: Initialization of the static variable '<variable name>' is not constant, or replaced constants is disabled.

. Possible error causes:
  • VAR_STAT and CONSTANT declarations are used together in a function block declaration.

  • The Replaces constants compile option is disabled.

Example 492. Example

The Replace constants compile option is disabled.

VAR CONSTANT
        iMaxInst : INT := 2;
END_VAR
VAR_STAT
        iIDs : INT := iMaxInst - 1;
END_VAR

Message:

C0549: Initialization of the static variable 'iIDs' is not constant, or replaced constants is disabled.

Error correction:

In Project → Project Settings, on the Compile Options tab, enable the Replace constants compile option.