CompilerIf and macro inside if statement

Just starting out? Need help? Post your questions and find answers here.
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

CompilerIf and macro inside if statement

Post by nsstudios »

Hi all,

I have a very confusing problem on Mac.
If I try this code on Windows (and modify it to be not isWin), it works fine, but on Mac OS, the compiler still tries to find #sanity. Any idea why this is the case?

Code: Select all

Macro isWin:#PB_Compiler_OS=#PB_OS_Windows:EndMacro
n=0
If Not n
CompilerIf isWin
n=#sanity
CompilerEndIf
Else
MessageRequester("wtf","")
EndIf
It, however, works perfectly fine if I manually expand the macro.
:shock:

Code: Select all

n=0
If Not n
CompilerIf #PB_Compiler_OS=#PB_OS_Windows
n=#sanity
CompilerEndIf
Else
MessageRequester("wtf","")
EndIf
:?:

I'd appreciate if someone can help figure out the problem.