Found the glitch -- it's down in QB64.bas where we evaluate our $IF statements, in the FUNCTION EvalPreIF (text$, err$). Look down in the code there, and you'll see this segment:
IF INSTR(symbol$, "=") THEN 'check to see if we're equal in any case with =
FOR i = 0 TO UserDefineCount
IF UserDefine(0, i) = l$ AND UserDefine(1, i) = r$ THEN result$ = " -1 ": GOTO finishedcheck
NEXT
IF NOT UserFound AND LTRIM$(RTRIM$(r$)) = "UNDEFINED" THEN result$ = " -1 ": GOTO finishedcheck
IF UserFound AND LTRIM$(RTRIM$(r$)) = "DEFINED" THEN result$ = " -1 ": GOTO finishedcheck
END IF
The issue here is the variable UserFound... If we search all of QB64, we won't find that variable in use *anywhere*. What the heck happened to it??? There's no way we can compare it to anything, if we never make it anything...
UserFound is supposed to be a simple little variable that says, "we found this variable in our list of user precompiler variables", or not... Instead, it no longer exists inside QB64...
And my mind melts trying to sort out what/when/how it disappeared. /sigh
Fix is rather simple -- swap out that small segment of code, and replace it with this one:
IF INSTR(symbol$, "=") THEN 'check to see if we're equal in any case with =
UserFound = 0
FOR i = 0 TO UserDefineCount
IF UserDefine(0, i) = l$ THEN
UserFound = -1
IF UserDefine(1, i) = r$ THEN result$ = " -1 ": GOTO finishedcheck
END IF
NEXT
IF UserFound = 0 AND LTRIM$(RTRIM$(r$)) = "UNDEFINED" THEN result$ = " -1 ": GOTO finishedcheck
IF UserFound = -1 AND LTRIM$(RTRIM$(r$)) = "DEFINED" THEN result$ = " -1 ": GOTO finishedcheck
END IF
Save, recompile, and you're good to go.
I'll push changes into the repo build to make this glitch go away, so grab a fresh copy after it updates in a day or so, and $IF UNDEFINED and $IF DEFINED will work as intended for you. If you don't want to grab a whole new version of QB64 for something so simple, just make the changes and recompile yourself. I dunno know where UserFound disappeared off too, but it's simple enough to put it back in there so our comparisons work once again. ;)