FLTK/Basic applications

Basic window source code
Here is the smallest FLTK application, it shows an empty window:

Compiling and running this piece of code yields the following kind of window:

Basic application compilation
To build above code, first save it to a file named test.cxx. You can also use test.cpp, but the cxx extension is the one used by FLTK source code.

We assume GCC is installed, since it is required to build FLTK. Depending on the environment, windowing system libraries need to be linked against the executable. Basically, the following command is the minimum required to build test.cxx:

g++ -o test test.cxx -lfltk2

Using the X Window system (GNU Linux for example), you usually need to add the following ones:

g++ -o test test.cxx -lfltk2 -lXi -lXinerama -lXft

Under Mac OS X, you'll have to link with the Carbon framework:

g++ -o test test.cxx -lfltk2 -framework Carbon