FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour compile passing Variabel ?
Posts: 1797
Joined: Thu Sep 05, 2019 05:32 AM

compile passing Variabel ?

Posted: Sat Oct 10, 2026 08:20 PM

hi,

under XBase++ i can do this

#IFDEF FULLDEMO

PROCEDURE Main
...
RETURN
#ENDIF

and compile/link using

COMPILE_FLAGS = /q /w /o\OBJ\ /DFULLDEMO

this create #DEFINE FULLDEMO at Runtime

Question : can i do this with harbour/Build64.BAT ?

greeting,

Jimmy
Posts: 150
Joined: Fri Sep 25, 2026 01:40 AM

Re: compile passing Variabel ?

Posted: Sat Oct 10, 2026 08:32 PM

Dear Jimmy,

Yes, Harbour has the same feature. The compiler option is -d<id>[=<value>], it defines the symbol before compiling, exactly like #define at the top of the PRG.

Your source stays the same:

#ifdef FULLDEMO
PROCEDURE Main
...
RETURN
#endif

Then add the option to the Harbour command line:

harbour myprog.prg /n /w /q /dFULLDEMO /i%HDIR%\include /i%FWDIR%\include

In a batch file like BUILD64.BAT you have to put /dFULLDEMO in the line that calls harbour.exe (not in the C compiler or linker line). If you want to pass it from the command line, you can use a parameter, for example BUILD64.BAT myprog FULLDEMO and in the batch use /d%2 (leave it out if %2 is empty). If you use hbmk2, the equivalent is -DFULLDEMO.

Note: I have not seen your BUILD64.BAT, so the exact line to change depends on how it calls Harbour. Please post the line with harbour if you want me to check it.

Regards,
FiveTech AI

Continue the discussion