CS 638 Graphics
Instructor: Dr. Gleicher
TA: Richard Yu Gu
Updated Septmber 2000, Michael Gleicher
Last modified: 16:14 Sep 12, 2000
1 Introduction
The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a LGPL'd C++ graphical user interface toolkit for X (UNIX®), OpenGL®, and Microsoft® Windows® NT 4.0, 95, or 98.
This tutorial shows how to construct GUI applications using FLTK with Microsoft Visual C++ 6.0.
This tutorial documentation is intended for the reader to quickly get started with FLTK library under MSVC++ for the Graphics class. Note: This is neither a detailed or complete documentation for the FLTK library or MSVC++. Instead, it walks you through the process of building a program with fltk in the U. Wisconsin CSL software environment.
For the complete documentation please check at http://www.fltk.org/, or locally at s:\fltk\documentation\. Since this documentation is intended for the students in the Graphics class only, we assume that you are using the instructional NT stations in the CSL labs.
2 Creating A New FLTK Work Space In Visual C ++ 6.0
This process should create a new directory with "name" at your specified location containing the project files, and open the project up in the MSVC++ program.
Note: One big advantage of FlTk over some of the other UI toolkits is that it can be built into a console application. That means that all of the C++ standard I/O stuff you used under Unix (like printf or cout) can be used in your programs.
3 Setting-Up the FLTK project
Now the new project is created, we are going to configurate it to be a FLTK project.
this tells the compiler where the header files for the library
are.
this allows the linker to find FLTK library binary files.
The following steps will set the project, so that correct output format is used when generating object files.
Then we need to tell the linker to use the essential librarys when creating the executable file. Notice that we must change the settings for both "Debug" and "Release" versions. For debug, we need to specify the debug version of the fltk library. Also, notice that we are adding the 2 libraries to our program, so we must be careful not to remove any others.
4 Create and Add Source Files The The Project
After you have all the options setup, the project is FLTK ready. All you need is to add your FLTK source files to the project, then build and run.
To add source files to the project, you need to follow the following instruction.
One working example program source code is here. You can try this file first to make sure that all the options for the project is setup correctly.
There is a working example project here. You can use the settings of this project as a template for our programs.
For more FLTK code examples please refer to the FAQ of this tutorial.
5 Build And Run
Choose Project->Build [projectname].exe.
Now choose Project->Execute [projectname].exe
This should compile and link this project, and launch the new executable.
If during Build process, error messages are generated, then there might be some problem with either your code or some settings that we have done. For more detail please refer to Trouble Shooting.
If the errors occur at other places, most likely the problem is in your program code itself.
Note: You can choose to build and run the project in either Debug or Release configuration by choosing the desired option through Build->Set Active Configuration... menu.
6 Reopen A Project
The easiest way to do so is to go to the project directory and double-click on the [projectname].dsw file.
Or you can choose File->Open WorkSpace within the MSVC application, and open the [projectname].dsw file.
7 FLTK Basics
The FLTK standard for library include files is to include the file
with FL/ path correct in the file name.
For example, if you need to use Fl_Window object, then you should have this line in your code:
#include <FL/Fl_Window.H>
Appendix A. Trouble Shooting.
You did not set the "Directories" "Include Files"
path correctly for the FLTK library, refer to steps 3.3-3.5
Most likely caused by some problem in your code.
Most likely caused by some problem in your code.
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of
other libs; use /NODEFAULTLIB:library
This means that you did not compile your program with the correct
code generation settings, described above, refer to steps
3.9-3.14
To be updated when more questions come up.