Go home
Go back to other tutorials

How to build HARBOUR from source in 10 minutes - Tutorial


Giovanni Di Maria - calimero22@yahoo.it
since: Jul 6, 2012



Tutorial


This Tutorial:
Rev. [1] - Jul 6, 2012
Rev. [170] - May 17, 2013






Index




Introduction
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. You'll need:


Giovanni Di Maria




Legal Notices
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

  1. Download nightly version of Harbour from http://sourceforge.net/projects/harbour-project/files/
  2. Install it enabling the installatin of MinGW GCC compiler (if asked)
  3. At the end of procedure, the gcc compililer will be in the folder C:\hb32\comp\mingw\bin




Building Harbour

  1. Go to URL: https://github.com/harbour/
  2. Click on "core" link
  3. Download sources by clicking on "ZIP" link
  4. Unzip the archive in any folder
  5. Open a console window, with the menu Start -> Run -> cmd
  6. Go to folder of sources of Harbour, by typing cd c:\core-master (or other specified)
  7. Set the path: PATH=C:\hb32\comp\mingw\bin
  8. Set an environment variable: SET HB_INSTALL_PREFIX=c:\harbour
  9. Type the command win-make.exe clean install, followed by "Return" key, to start the building. This process could take long time
  10. 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

  1. Now you can compile a simple text-mode program. Open the console window and go to your working directory (for example: c:\temp)
  2. Set the path of your gcc compiler and the path of your Harbour compiler with: PATH=C:\hb32\comp\mingw\bin;c:\harbour\bin
  3. Write your test.prg program, to show the message "Hello World"
  4. Compile this source with the command hbmk2 test.prg. It will create the file test.exe
  5. Once the executable is generated, execute the program with command test. The message will appear on the screen




Appendix A - Contributors




Appendix B - What users think