Introduction
FLTK officially supports Windows 10 and later. The library can be built using:- Microsoft Visual Studio (2019 or later recommended)
- MinGW/MSYS2 (GNU toolchain for native Windows)
- Cygwin (POSIX compatibility layer - not actively tested)
Visual Studio Build
Prerequisites
Install the required tools:-
Visual Studio - Download from visualstudio.microsoft.com
- Visual Studio 2019 Community or later (free)
- Visual Studio 2017 or later with CMake support
- Earlier versions: Visual Studio 2008 with service packs (minimum)
-
CMake - Download from cmake.org
- Visual Studio 2017+ has built-in CMake support
- Standalone CMake GUI recommended for older versions
Visual Studio Community Edition is free and fully functional for FLTK development.
Downloading FLTK
- Stable Release
- Git Development
Configuring with CMake
- CMake GUI
- Command Line
- Visual Studio 2017+
- Launch CMake GUI
- Set Where is the source code to your FLTK directory
- Set Where to build the binaries to
C:\path\to\fltk\build - Click Configure
- Select your Visual Studio version as the generator
- Choose platform (Win32 or x64)
- Click Done
- Review options and click Generate
- Click Open Project to launch Visual Studio
README.CMake.txt for detailed configuration options.
Building FLTK
- Visual Studio IDE
- Command Line
- Open
FLTK.slnin Visual Studio - Choose Debug or Release configuration
- Right-click the demo project
- Select Set as StartUp Project
- Press F7 or select Build > Build Solution
Testing FLTK
Run the demo program:- From Visual Studio
- From Explorer
- Ensure demo is the StartUp project
- Press F5 or select Debug > Start Debugging
- Use the Demo launcher to explore test programs
Building Your Applications
Create a new Visual Studio project:- Create a new Empty Project
- Add your source files (e.g.,
main.cxx) - Configure project properties:
- C/C++ > General > Additional Include Directories:
C:\path\to\fltk\build - Linker > Input > Additional Dependencies: Add
fltk.libandComctl32.lib
- C/C++ > General > Additional Include Directories:
- Build and run with F5
Static linking (
.lib files) is strongly recommended over DLLs to avoid version conflicts and deployment issues.MinGW/MSYS2 Build
Prerequisites
Download and install MSYS2 from msys2.org.As of December 2024, traditional MinGW development appears dormant. MSYS2 with MinGW-w64 is the recommended alternative.
Downloading FLTK
In the MSYS2 shell:Building FLTK
Configure and build:Testing FLTK
Installing FLTK
System-wide installation:Building Your Applications
Usefltk-config to compile:
Windows-Specific Features
Console vs GUI Applications
Control whether your application shows a console window:- MinGW/GCC
- Visual Studio
Use linker flags:
FLUID Integration
Integrate FLUID (FLTK’s UI designer) into Visual Studio:- Add a
.flfile to your project as a header - Right-click > Open With > Add
fluid.exe - Set as default editor
- Configure Custom Build Tool:
- Command Line:
fluid.exe -c $(InputPath) - Description:
Compiling Fluid .fl file - Outputs:
$(InputDir)$(InputName).cxx; $(InputDir)$(InputName).h
- Command Line:
- Add the generated
.cxxfile to your project
OpenGL Support
OpenGL should work automatically. To verify OpenGL is enabled, checkconfig.h: