QB64 Phoenix Edition
Compiler commands - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10)
+---- Thread: Compiler commands (/showthread.php?tid=1492)



Compiler commands - eoredson - 02-21-2023

Hi,

I have looked through the Wiki and commands and _commands but nowhere have I found a description for the $ compiler commands..

I am aware of $Dynamic, $Static and $Include compiler directives, but what I need to know are the $IF keywords and variables..

Thanks,

Erik.


RE: Compiler commands - mnrvovrfc - 02-21-2023

https://qb64phoenix.com/qb64wiki/index.php/$IF

A fake variable could be defined with $LET:

Code: (Select All)
$LET SOMETHN=5
$IF DEFINED SOMETHN THEN
' do this
$ELSE
' complain about "somethn"
$END IF

Note that you cannot leave out the "$LET", especially the dollar sign if you expect a compiler directive.

Otherwise could check for the OS the program is being compiled on:

Code: (Select All)
$IF WIN THEN
' do your Windows routines with confidence here
$ELSEIF LINUX THEN
' Linux-only stuff here
$ELSE
' assume it's for MacOS then
$END IF



RE: Compiler commands - RhoSigma - 02-21-2023

https://qb64phoenix.com/qb64wiki/index.php/Keyword_Reference_-_Alphabetical#I_(QB64)

https://qb64phoenix.com/qb64wiki/index.php/Metacommand#OB64_Precompiler_Commands


RE: Compiler commands - eoredson - 02-21-2023

Thanks, I have the wrong older Wiki url

Try this:

Code: (Select All)
$Let SOMETHN = 5
$If SOMETHN Then
  ' do this
$Else
      ' complain about "somethn"
  $If WIN Then
        ' do your Windows routines with confidence here
  $ElseIf LINUX Then
        ' Linux-only stuff here
  $Else
        ' assume it's for MacOS then
  $End If
$End If