You can find a generic description of how to build Harbour from source at the master github repo:
https://github.com/harbour/core#how-to-buildBut this article will focus on real, step by step, instructions for those developing in Microsoft Windows.
This article is also a practical guide for VFP developers intending to use Harbour.
One of the main reasons to use Harbour on Windows, is the ability to use and create COM objects. This allows you to have Object Oriented language interoperability.
For VFP developers, this could be a means to add Harbour components to your VFP app, or add to Harbour VFP COM objects.
This article will also be regularly updated as new versions of Windows and C compilers are made available.
The Harbour compiler takes PRG files, creates some C source code equivalent files, than relies on a C compiler and linker to create the actual binaries.
There are two methodologies for Harbour to create the C source code files. One, the most common, is to create C code that has some PCODE in it, which are basically a series of arrays with numeric values. This method relies on a Harbour Virtual Machine (HVM), and Harbour Runtime Library (HRL). But all of this gets linked inside a single EXE you generate with Harbour. The second method is to create C code that does not rely on a HVM, and creates all pure C code, that can still use the HRL. VFP use a PCODE only approach, by creating FXP files, which then can get packaged in APP and EXE. But unlike VFP, Harbour does not rely on VFP runtime files (.dlls). So you may wonder, why even have a PCODE method in Harbour. The generated C code is smaller, while the source PRGs are larger.
Also one of the huge advantages of the way Harbour works, by generating C code, is that final EXEs are protected from decompilation. Any decompilation would result in hard to read C code, never your original PRG source files.
.Net, Java programs can be easily decompiled. NodeJS, Python (generic version), PHP and others requires distribution of source code. Even VFP could be decompiled (but difficult if branded via 3rd party commercial products). C, C++, assembler, Delphi, and Go are probably the most reverse engineering proof languages to use. Harbour, xHarbour and Xbase++ (by Alaska Software), all generate intermediate C code. xHarbour was a commercial fork of Harbour, but all of its features are now in Harbour. Xbase++ is a closed code commercial license product, that only generates 32 bit Windows programs, and to my knowledge, will not allow you to create COM servers. Harbour is the only compiler that is open source, 100% free, 32 and 64 bit, and virtually runs on all platforms C can run on, like Windows, DOS, Mac, Unix, and Linux. VFP still has some huge advantages compared to all those languages, more to come on this.
There are many C compilers available under Windows. The main Harbour documentation claims many can be used to compiler programs. But if you want to also build COM objects, in my experience use MinGW or Microsoft C. MinGW has the advantage of being open source and much smaller to install. Also when creating a 32 bit COM object, you will only need to distribute a small support dll file (libgcc_s_dw2-1.dll), and none when creating 64 bit COM objects. Alternatively with Microsoft C, if you don't already have it, you will need to install Visual Studio 2017, on Windows 8.1 or above, and distribute a C/C++ runtime installer for non Windows 10 or above users.
I will focus on installing MinGW, the Harbour source code, and how to compile it under Windows 32 and 64 bit. Then will show how to test your install with the standard "Hello World" program. I will not describe how to build Harbour with Microsoft C, since Installing Visual Studio can take one hour, require a huge amount to download, and uninstalling it can be a real nightmare, and leave lots of unwanted programs on your computer.
For VFP developer wanting to use Harbour COM objects, or consume VFP COM objects in Harbour, you must always compile in 32 bit mode.
You may wonder why create 64 bit DLL? You could consume them from a C++ FastCGI app for example, under Windows.
You can also call Harbour COM object from PowerShell 32 and 64 bit !
64 bit apps will also help you break the 2Gb file size limit of DBF / FPT files, and read and write any files of almost any size!