FLTK howto

From Open Watcom

Jump to: navigation, search

The following assumes Win32, Watcom 1.7a, Cmake >=2.4, optional SVN client such as tortoiseSVN

CMake CMake is a rapidly rising in fame tool after KDE4 chose it for their very complex build system.

tortoiseSVN tortoiseSVN tightly integrates with the Windows shell, allowing local or remote repositories.

Install the source tree to a directory on a path without spaces. Can be done from archive download or via SVN (URL on website) where the details are left as an exercise.

FLTK 1.1.10 is the most mature, 1.3 is evolutionary (V2.0 is not yet turnkey with Watcom) Which to try is a difficult choice, best read the website. The 1.1.x series does not support Unicode. However, it's been around longest, so more programs are designed to work with that library. Many versions of FLTK were forked, some by the FLTK project and some by individuals, in order to include Unicode support. The latest version presently being worked on by the FLTK project that should support Unicode is the 1.3.x series. Fast Light ToolKit

Following instructions are common to either version of toolkit.

There is historic provision for Watcom but that is ignored here where we use Cmake instead. Cmake creates valid Wmake files from high level build instructions and is automatic. Cmake can also do out of source build, meaning that the libraries and any executables are put on a directory path anywhere you like. (although I have not tried paths containing spaces)

Copy file config.h from the source directory /watcom/ up one level to the toolkit root. This is a vital configuration file, sometime examine the contents.

Run the Cmake Windows GUI.

Point "Where is the source code" at the toolkit root directory.

Point "Where to build the binaries" to where you want the Cmake working directory put, contains a lot of files, copies of headers, built libaries, compiled test programs. If it does not exist, Cmake will offer to create the directory.

What follows is do not panic or worry! Will show problems in red, are just undecided things. Defaults can be left, don't change anything.

Click Configure

 First time on doing this CMake will probably ask which version of Make to use, choose Watcom wmake from the list.
 CMake will complain anyway, ignore it

Click Configure

 it will stop complaining as much and Generate button should become live.

Click Generate

 ignore the messages

All being well we are almost ready to roll.

Open a file explorer on the build directory you specified above, now contains the build instructions.

Hardcore can command line wmake there. Assuming all the environment paths are set it is as complex as


I am lazy. I use a batch file containing something like the following, actually a copy of makevars.bat from the watcom distribution.

Edit the FLTK path to whereever you have put the toolkit source.

 @echo off
 SET PATH=C:\watcom\BINNT;C:\watcom\BINW;%PATH%
 SET WATCOM=C:\watcom
 SET INCLUDE=C:\watcom\H;C:\watcom\H\NT
 SET FLTK=c:\compiles\fltk-1.3

Save in the build directory.

All being well double click the bat and sit back, take a few of minutes for the build.

What else? Nothing, all done.

Go into the /bin/ directory off the build directory and there should be the test programs.

Fluid.exe a GUI construction utility will be in there too.

Change the Cmake config for Debug, Release, as you wish, all seems to work. (is also a build for smallest size version, default is fastest)

Yes the Watcom debugger works with these files.

If you're using version 1.9 of Open Watcom and attempting to build version 1.1.10 of FLTK, the following patch may be needed in order to get the cmake method mentioned above to work without compilation errors. If there's a way to set -dWINVER=0x0500 and -d_WIN32_WINNT=0x0500 compiler flags before compiling with cmake that would remove the need for the patch altogether.

--- old\fltk-1.1.10\src\screen_xywh.cxx	2007-05-20 12:18:31.000000000 -0400
+++ new\fltk-1.1.10\src\screen_xywh.cxx	2010-06-20 12:03:42.611088400 -0400
@@ -35,6 +35,7 @@
 static int num_screens = 0;
 #ifdef WIN32
+#define _WIN32_WINNT 0x0500
 #  if !defined(HMONITOR_DECLARED) && (_WIN32_WINNT < 0x0500)
 #    include <multimon.h>
@@ -48,6 +49,16 @@ static int num_screens = 0;
 // "GetMonitorInfoA", it would be impossible to use FLTK on Windows 2000
 // before SP2 or earlier.
+typedef struct tagMONITORINFO {
+    DWORD   cbSize;
+    RECT    rcMonitor;
+    RECT    rcWork;
+    DWORD   dwFlags;
+#define SM_CMONITORS                    80

There's some further information on the compiling issue in this post on the FLTK development mailing list.

Creating an FLTK Hello World GUI executable under the Watcom IDE and debugger

Personal tools