Go back to other tutorials
How to build HARBOUR from source in 10 minutes - Tutorial
Giovanni Di Maria - email@example.com
since: Jul 6, 2012
Rev.  - Jul 6, 2012
Rev.  - May 17, 2013
This is a short but simple tutorial that explains how to compile Harbour from source,
for Windows system. It explains also how to use Harbour to compile your programs.
It is specifically written for beginners that initially encounter some difficulties,
building Harbour. Many guides on the Internet are complicated and have the defect of presenting
the subject in a confused manner. The biggest flaw is to show many environment variables
and paths to be set, even if they are not needed. In this way the beginners become discouraged
and leave the idea of compiling Harbour.
This tutorial explains just the basic facts, reducing the rules to follow.
- Supported ANSI C compiler
- GNU Make (3.81 recommended, minimum 3.79 required, see also platform details). A copy of this tool is included in all Harbour packages, so you don't have to do anything.
- Harbour sources (2.0.0 or upper)
Giovanni Di Maria
This tutorial is a free document and will remain free. You can view, use, print and
redistribute it and/or modify it, without any limitations.
Download and install MinGW compiler
- Download nightly version of Harbour from http://sourceforge.net/projects/harbour-project/files/
- Install it enabling the installatin of MinGW GCC compiler (if asked)
- At the end of procedure, the gcc compililer will be in the folder C:\hb32\comp\mingw\bin
- Go to URL: https://github.com/harbour/
- Click on "core" link
- Download sources by clicking on "ZIP" link
- Unzip the archive in any folder
- Open a console window, with the menu Start -> Run -> cmd
- Go to folder of sources of Harbour, by typing cd c:\core-master (or other specified)
- Set the path: PATH=C:\hb32\comp\mingw\bin
- Set an environment variable: SET HB_INSTALL_PREFIX=c:\harbour
- Type the command win-make.exe clean install, followed by "Return" key, to start the building. This process could take long time
- If compilation is successful, the "postinst script finished" message appears
SVN tool (Subversion for Windows) can be downloaded from: http://sourceforge.net/projects/win32svn. You can use also Tortoise SVN.
Compiling a simple program
- Now you can compile a simple text-mode program. Open the console window and go to your working directory (for example: c:\temp)
- Set the path of your gcc compiler and the path of your Harbour compiler with: PATH=C:\hb32\comp\mingw\bin;c:\harbour\bin
- Write your test.prg program, to show the message "Hello World"
- Compile this source with the command hbmk2 test.prg. It will create the file test.exe
- Once the executable is generated, execute the program with command test. The message will appear on the screen
Appendix A - Contributors
- Giovanni Di Maria (he is still the main developer)
- Massimo Belgrano (he gives very useful tips)
Appendix B - What users think
- Great ;) (Antonio Montagut)
- Thanks a lot!!! (Francis JS)
- Hola Giovanni...! Excelente Tutorial..!! (Andres Ortiz Diaz)
- Hello Giovanni. Thank you very much for this manual :) Excellent contribution. Best Regards. (Rossine)
- Hi. An excellent tutorial How to build HARBOUR … by an excellent Harbour fan: Giovanni Di Maria. Regards / Saludos (Esgici in hmgforum.com)