How to install FLTK with MS Visual C++ 2010 Express

1. Go to http://fltk.org and download the latest release (zip file, such as “fltk-1.3.0-source.tar”)

2. Copy it to C:/ and unzip the file.

3. Open Visual C++ 2010, go to C:\fltk-1.3.0\ide\VisualC2010, open “fltk.sln”.

4. From the Build menu, choose build solution. When the process is completed, close Visual Studio.

5. From the main FLTK directory, open the lib folder. Copy all the .lib files except README.lib (there should be seven) into C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib.

6. Go back to the main FLTK directory, coy the FL folder into C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include.

A quick test to use FLTK in Visual Studio

1. Create an empty “win32 project“. Make sure it is empty. Otherwise, a lot of stuff will be added to your project unnecessarily.

2. In Visual Studio, choose Project from the main (top) menu, and from the drop-down menu choose Properties.

3. In the Properties dialog box, in the left menu, click the Linker folder. This expands a sub-menu. In the sub-menu, click Input. In the Additional Dependencies text field on the right, add the following text:

 fltkd.lib; wsock32.lib; comctl32.lib; fltkjpegd.lib; fltkimagesd.lib

4. In the Ignore Specific Default Libraries text field, enter the following text: libcd.lib

5. In the left menu of the same Properties window, click C/C++ to expand a different sub-menu. Click the Code Generation sub-menu. In the right menu, change the Runtime Library drop-down to Multi-threaded Debug DLL (/MDd). Click Ok to close the Properties window.

6. Create a single new source code file .cpp in the new project, and enter the following code.

 

#include <FL/Fl.h>

#include <FL/Fl_Box.h>

#include <FL/Fl_Window.h>

 

int main()

{

Fl_Window window(200, 200, “My_window_title”);

Fl_Box box (0, 0, 200, 200, “Hello, world!”);

window.show();

return Fl::run();

}

 

7. Build and run.