How I can migrate ?

How I can migrate DOS  to Windows ?

By principle, Harbour  can compile every Clipper Language program; and Harbour applications can run under Windows ( besides many other platforms ) with no problem. This is one of main goals of Harbour project.

Furthermore, Harbour compiled executables will be 32 bit, not 16 😉

Maybe your application include many ( or too many ) .prg file; no problem; (almost) no modification required on your source code; nor extra scripts for compile. ( Thanks to Viktor Szakáts for really wonderful MAKE utility : HBMK2. )

Only  care is :  if “main” prg of your application doesn’t have a “main” module , add one PROCEDURE or  FUNCTION statement to most top of your “main” .prg.


That’s all 🙂

You can build your application via HMG by a .bat file (or direct command in the DOS box) such as :

CALL C:\hmg\build.bat /c <mainPrgName>

or via Harbour:

SET PATH=C:\harbour\bin;C:\hmg\mingw\bin;%PATH%
hbmk2 <mainPrgName> -RUN

or the simplest way :

    C:\harbour\bin hbmk2 <mainPrgName> -RUN

( hbmk2 will find all necessary  paths / files 🙂 )

Of course, you need supply name of your main .prg file in place of <mainPrgName>. You may also want to  change  “C:\hmg” and “C:\hmg\harbour” according to your install configuration.

Please be careful about PATH command : If you call the the .bat file from Windows explorer, no problem. If you are working on command (DOS) box, calling repetitively .bat file may cause problem by grown of PATH . In this case you may build a separate .bat for only PATH command and call it only once at beginning of DOS session.

If you want convert a text (console) based application to GUI ( Graphical User Interface ) based Windows application, this is another thing and there isn’t any automatic way for this.  You have need first a GUI library can be used into Harbour. After selecting which library is convenient to your needs and learning  this library, you may begin planing steps of converting process. Writing your application from scratch may be longest but most secure way.

There are links to some articles  about migration in the Links page; looking at this will be useful.

Building console application

How I can build a console application via HMG ?

We have a paradox here: though HMG is a GUI library, we are requesting a non-GUI service; since console means non-GUI.

But don’t wory, this is possible; even very easy, such as any HMG application, and with more than one method.

Method 1: Batch processing:

( Assuming HMG root folder is C:\hmg and name of your console application project file name is ConsOnly.HbP and your main prg file name is ConsOnly.Prg )

call c:\hmg\build.bat /c ConsOnly

( No matter ConsOnly is a project or program file. )

If your project has more than one .prg file, you may use build.bat such ways:

1- call c:\hmg\build.bat /c progr1 progr2 prog3 ...


2- First build a .hbp file contains such as:


and say name is “ConsOnly.Hbp” then invoke build.bat:

call c:\hmg\build.bat /c ConsOnly

The /c ( or /C ) switch inform build.bat about console.

You can omit this switch, by adding this line to top of your .prg file:


Method 2: Via HMG-IDE:

First you need add abowe


line to top of your .prg file.

And then, building a project file ( .hbp ). For example if your .prg file name is ConsOnly.prg, you may use a ConsOnly.HbP  file contains one line:


If your project has more than one .prg file, your project file contains a list of that .prg files. For example:


You may build this project file simply writing with a text editor or by selecting “New Project” within HMG-IDE.

And only thing is pressing “Run” button.

Yo don’t need any other thing.


Don’t include

#include <>

line into console-only .prg’s.

Technically no problem, you can add. Moreover with this  way, though project is console mode,   you can see error messages in GUI mode. But has a risk: may be some HMG functions have same names with Harbour and if you include “”, HMG functions will override others; an example may be  BROWSE(). If this is your intend,  no problem. But this situation sometime may be a nightmare.

Building a HMG application

How I can build a HMG applications ?

Build.Bat / HMG-IDE


The easiest way is to use the ‘build.Bat’ file located at \hmg folder.


Build [/i|/r|/d|/cs|/ci/cr] <PrgFile> | <filelist.hbp> [config.hbc]

[/i] : incremental build

[/r] : incremental build (rebuild all)
[/cs] : Console/mixed mode (std build)

[/ci] : Console/mixed mode (incremental build)

[/cr] : Console/mixed mode (incremental rebuild all)
[/d] : Debug mode (gui and console)

<filelist.hbp> : A text file with .hbp extension containing a source list.

<configfile.hbc>: A text file with configuration parameters as additional libs, include paths and lib paths.

<configfile.hbc> Syntax:

incpaths = incpath1 incpath2 … incpathn

libpaths = libpath1 libpath2 … libpathn

libs = lib1 lib2 … libn

mt = yes (multi-threading support)
– library names must not include ‘lib’ prefix nor ‘.a’ extension.

– ‘build.bat’ will create an ‘error.log’ file in the app folder when build process ends with an error condition.

– <.hbc> files in the current folder are automatically processed.



This programming environment allows visual form editing and application build.

Environment settings (HMG Folder, Program Editor, etc.) are stored in ‘.ini’ files, located at IDE folder.You can interactively change default settings (Main Menu->Tools->Preferences).

In IDE, all build customizations must be handled by the user from ‘Configuration’ (project browser) tab. It is direct edit of the project .hbc file. Look at hbmk2 help for details. By default two gt drivers are ALWAYS linked: GTGUI (as default) and GTWIN (Windows console). To create console/mixed mode apps. you only must add this line to your main .prg: HB_GT_WIN_DEFAULT

When upgrading HMG, please, clean previous build data from your projects using incremental building. From command line, you must add the -clean parameter. From IDE, use the ‘Reset project incremental data’ option from the project menu.


Note:  This post borrowed from official HMG Docs.

Build a Harbour application

How I can build a Harbour applications ?

Method 1 : By batch processing:

First you have two path definition: harbour\bin and mingw\bin

If  HMG installed in your PC, harbour and mingw directories are already exists. If your HMG root <dir> is c:\hmg, harbour\bin is :


and your mingw\bin is


If  HMG not installed or you want use other than HMG folders, you will change paths definitions according to your choice.

Than for this path definitions you will enter (preferably by a  a .bat file ) a command like this:

SET PATH=c:\hmg\HARBOUR\bin;c:\hmg\MINGW\bin;%PATH%

After run this batch file, it’s sufficient a single command for build your application ( in your working directory including <MyProg> of course ):

hbmk2 <MyProg>

hbmk is probably ultimate utility in make area; extremely versatile and extremely successful.

By command window (after changing current directory to harbour\bin or setting path as mentioned below) enter


(without any more world) for short help and

hbmk2 -help

for long one.

More detailed help may find in Harbour Project users’ mailing list.

Method 2 : By hbIDE

( With words of author, Pritbal Bedi) hbIDE, as the name implies, Harbour’s Integrated Development Environment, is an open-source, multi-platform, project. hbIDE is aimed at simplifying the process of project life-cycle comprising, setting-up the project components, editing the sources, building them to final binaries.

You may find more info on hbIDE  herehere and  project home page.

Building Harbour / HMG

How I can build Harbour and / or HMG?

Harbour and HMG both are open source project and it’s possible to (re)build them in your own machine.

But before we need find an answer to the question “why?”.  Both projects has their own binary ( executables, libs, etc ), even setup prg. If you want play on source code, surely you will find building method(s) by digging package.

Making some change in the source code may be educative, useful for understand more deeply the system; but sometime may be also  annoying.

First changing system source files will be risky in general; while changing some place, will be problematic other places, and at least you have make same change repeatedly for every next release of compiler / library.

And second, you have re-build compiler /  library for every change you made.

There is a mymake.bat and win-mak.exe in Harbour package and HMG has buildlib.bat .

And, an excellent tutorial How to build HARBOUR … by an excellent Harbour fan: Giovanni Di Maria.

Anyway, since primary goal is address to beginners, details of this issue is out of scope of this blog.