Compiler commands
#1
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.
Reply
#2
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
Reply
#3
https://qb64phoenix.com/qb64wiki/index.p...l#I_(QB64)

https://qb64phoenix.com/qb64wiki/index.p...r_Commands
Reply
#4
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
Reply




Users browsing this thread: 2 Guest(s)