CIS-255 Home: http://www.c-jump.com/bcc/c255c/c255syllabus.htm
These instructions explain how to download and install Fast Light Toolkit (FLTK) for bulding Graphical User Interface applications with MSVC++.
Download the source of the latest stable release version (e.g. fltk-1.3.2-source.tar.gz) from FLTK library website. FLTK is cross-platform tool that works on Linux, MAC OS, and Windows with MSVC++ 2005, 2008, 2010, and above.
Unzip the downloaded file. The process takes two steps: first, it unzips into a .tar file. Next, unzip the .tar file, which creates a folder named fltk-1.3.2 (or whatever version you downloaded.) For example,
C:\Users\yourname\Downloads\fltk-1.3.2
Navigate to folder
fltk-1.3.2\ide\VisualC2010
Double-click the file named fltk.sln. It opens a large MSVC++ solution that includes FLTK demo apps and the library itself. Be patient, as it takes almost a minute to load all parts into Visual Studio development environment.
Since FLTK is distributed as open source software, you must build the library on our own machine. Go to Visual Studio menu
Build -> Configuration Manager...
and switch active configuration to Release.
Click Visual Studio menu
Build -> Rebuild Solution
Be patient as the surce code is being compiled. It will take several minutes to finish. If everything is okay, you should see a message similar to
========== Rebuild All: 79 succeeded, 0 failed, 0 skipped ==========
at the end.
Exit Visual Studio.
Once built, FLTK can be added to Visual Studio development environment. To begin, locate Visual C++ installation folder on your local machine. In most cases it is
On 32-bit machine: C:\Program Files\Microsoft Visual Studio 10.0\VC On 64-bit machine: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
There are two steps:
Copy FL and GL folders, for example,
C:\Users\yourname\Downloads\fltk-1.3.2\FL C:\Users\yourname\Downloads\fltk-1.3.2\GL
to the include folder of Visual Studio:
On 32-bit machine: C:\Program Files\Microsoft Visual Studio 10.0\VC\include On 64-bit machine: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
Copy all files from the lib folder,
C:\Users\yourname\Downloads\fltk-1.3.2\lib
to the lib folder of Visual Studio:
On 32-bit machine: C:\Program Files\Microsoft Visual Studio 10.0\VC\lib On 64-bit machine: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
Start Visual Studio again.
Click
File -> New -> Project
Select Win32 Project for the project type. Choose a name, e.g. fltk_win32_app, and change project location to
C:\CIS255\Projects
or something similar. Click Next on the project wizard screen and check "Empty project" option, then Finish.
Click
View -> Solution Explorer
Right-click on Source Files and choose
Add -> New item...
Use C++ File (.cpp) for the type of the file. Name it main.cpp.
The empty main.cpp file automatically opens in the editor. Copy and paste the following code:
#include <Windows.h> // include Windows.h only if using WinMain #include <FL/Fl.H> #include <FL/Fl_Box.H> #include <FL/Fl_Window.H> // Use standard main to have console background: // int main() // Use WinMain if you don't want the console in the background: int __stdcall WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd ) { Fl_Window window( 200, 200, "My window title" ); Fl_Box box( 0, 50, 200, 20, "Hello" ); window.show(); return Fl::run(); }
In the Solution Explorer, right-click fltk_win32_app project and select Properties. You need to make the following three changes:
Configuration Properties C/C++ Code Generation Runtime Library <<Edit..>> and set it to Multi-threaded DLL (/MD) Linker Input Additional Dependecies <<Edit..>> and enter fltk.lib Ignore Specific Default Libraries <<Edit..>> and enter libcd.lib
For example,
Click OK and save your changes.
Click Visual Studio menu
Build -> Rebuild Solution
Press F5 to run the program.
Everything should compile and run without any problems. If you do get an error, send me an email, so I can look at the issue.