Informix Error -4045: Member "name" is defined in class "class", but not as a variable or constant.
Cause and resolution
Member "name" is defined in class "class", but not as a variable or constant.
The identifier name is defined in the class, but as something other than a variable or a constant, such as a member function. Check the spelling of the member name and the class or object name.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4045 fires when a name is used as if it were a variable or constant member of a class, but it's actually defined as something else (such as a member function) — per the official guidance, the identifier exists on the class, just not in the expected role.
- A member referenced as a variable/constant that's actually defined as a function (or other non-variable/constant kind), per the official guidance — the direct, only cause.
Solutions / Resolution
- Check the spelling of the member name and the class or object name, per the official guidance, and confirm the member's actual kind.
Examples
Treating a member function as a variable
LET x = order.total
-- -4045: "total" is defined on Order as a member FUNCTION, not a variable
Corrected
LET x = order.total()
Diagnostic Checks
- Check the class declaration for the member's actual kind (variable, constant, or function), and reference it accordingly.
Related Errors / Related Topics
- -4044 — "Member "name" not defined in class "class"." A related member-access error, about a member that doesn't exist at all rather than one that exists as the wrong kind.
- -4051 — "Member "name" is defined in class "class", but not as a function." The mirror-image error, about a member expected to be a function but actually being a variable.
A class member is referenced as a variable/constant but is actually a different kind (e.g. a function) — reference it according to its actual kind.