🚢
Harbour Compiler
Modern open-source xBase compiler for cross-platform development
Modern open-source xBase compiler for cross-platform development
A powerful, cross-platform xBase compiler that brings modern capabilities to classic xBase development.
Compile your xBase code for Windows, Linux, macOS, and many other platforms.
Completely free and open-source with an active community and continuous development.
Unicode support, advanced debugging, and integration with modern development tools.
Easy integration with C libraries and the ability to create C extensions.
Choose your platform and follow the installation steps.
# Ubuntu/Debian sudo apt update sudo apt install harbour # Fedora/RHEL sudo dnf install harbour # Arch Linux (AUR) yay -S harbour # Or compile from source: cd $XBASE_WORKSPACE git clone https://github.com/harbour/core harbour-core cd harbour-core make sudo make install
Download precompiled Harbour binaries for Windows from the official releases.
# Using package managers: # Chocolatey choco install harbour # MSYS2 pacman -S mingw-w64-x86_64-harbour # Manual installation: # 1. Download from GitHub releases # 2. Extract to C:\harbour # 3. Add C:\harbour\bin to PATH # 4. Set HB_PATH=C:\harbour
# Using Homebrew brew install harbour # Using MacPorts sudo port install harbour # From source with Xcode tools: xcode-select --install cd $XBASE_WORKSPACE git clone https://github.com/harbour/core harbour-core cd harbour-core make sudo make install
Make sure you have a C compiler (GCC, Clang, or MSVC) and make/cmake installed before proceeding.
# Clone the repository cd $XBASE_WORKSPACE git clone https://github.com/harbour/core harbour-core cd harbour-core # Configure environment (optional) export HB_COMPILER=gcc export HB_BUILD_OPTIM=yes # Build Harbour make # Install system-wide (Linux/macOS) sudo make install # Windows: copy bin directory to desired location # and add to PATH environment variable
Create and compile your first Harbour program.
// hello.prg
PROCEDURE Main()
? "Hello, World from Harbour!"
? "Current date:", Date()
? "Current time:", Time()
WAIT "Press any key to exit..."
RETURN
# Compile to executable hbmk2 hello.prg # Run the program ./hello # Alternative: compile and run in one step hbmk2 -run hello.prg
Use hbmk2 instead of direct harbour command. It's the modern build tool that handles dependencies and linking automatically.
Explore Harbour's modern capabilities beyond basic xBase compatibility.
Built-in support for DBF, MySQL, PostgreSQL, SQLite, and many other database formats.
Create web applications with Harbour's built-in web server and CGI support.
Multiple GUI frameworks available for desktop application development.
Call C/C++ libraries and integrate with other programming languages.
Organize your Harbour projects for maximum productivity.
$XBASE_WORKSPACE/
├── harbour-core/ # Harbour compiler source
├── HB_Projects/ # Your Harbour projects
│ ├── MyApp/
│ │ ├── src/ # Source code (.prg files)
│ │ ├── include/ # Header files (.ch)
│ │ ├── lib/ # Libraries
│ │ ├── build/ # Compiled output
│ │ ├── docs/ # Documentation
│ │ ├── tests/ # Test files
│ │ ├── hbmk.hbm # Build configuration
│ │ └── README.md
│ └── Common_Libs/ # Shared libraries
│ ├── utils/
│ ├── database/
│ └── gui/
└── Tools/ # Development tools
├── editors/
├── debuggers/
└── utilities/
# hbmk.hbm - Build configuration file -hblib # Project settings -o../build/myapp # Include paths -I./include -I../Common_Libs/include # Library paths -L./lib -L../Common_Libs/lib # Source files src/*.prg # Libraries to link -lhbcommon -lhbcpage # Debug mode (remove for release) -debug
Recommended tools for Harbour development.
Traditional command-line development tools.
Editors with Harbour syntax support.
IDEs specifically designed for xBase development.
Debug and profile your Harbour applications.
Common Harbour programming patterns and examples.
// Variables and arrays
LOCAL cName := "John Doe"
LOCAL nAge := 25
LOCAL aItems := {"Apple", "Banana", "Cherry"}
// Control structures
IF nAge >= 18
? cName + " is an adult"
ELSE
? cName + " is a minor"
ENDIF
// Loops
FOR nI := 1 TO LEN(aItems)
? "Item " + STR(nI) + ": " + aItems[nI]
NEXT
// Functions
FUNCTION GetFullName(cFirst, cLast)
RETURN cFirst + " " + cLast
// Error handling