FLTK – Fast Light Tool Kit

While working on an earlier project, I ran across a very good, portable window/widget tool kit. It goes by the name of FLTK (pronounced full-tick). A good tutorials exist here (note especially the “label pitfall”) and here which will teach you the basics. There are example programs in the full install found at the FLTK website along with an excellent programming manual. Documentation for previous releases is available. Ubuntu 10.4 LTS comes with FLTK 1.1.0.
When I began a new project, I decided to self-educate and used the second, pdf, tutorial above. I quickly worked through the examples until I got to 16. Handling mouse events part2 for the follow-the-mouse drawing program where I ran into a problem with the offscreenbuffer functions. I searched a bit for solutions. After reading more tutorials and more manuals, I discovered that the problem is that the example is omits several required includes. <stdlib.h> and <stdio.h> ¬†are easy. A bit more difficult is #INCLUDE <FL/x.H>. This include provides environmental information for X11, in particular the definition for FL_Offscreen. These details are covered in Appendix F Operating System issues and briefly at “Drawing Things with FLTK” in the later on-line versions of the programming manual. But x.H may not be apparent at first glance. A corresponding win32.H also exists but including x.H will pick up the correct info if your environment variables are set.
With those three additions, the example 16 program compiles and runs.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.