Sunday, April 19, 2009

FLTK in Visual C++ Express 2008

FLTK in Visual C++ Express 2008

1. Download fltk-1.1.9-source.zip
2. Unzip to C:\Server\fltk-1.1.9\
3. Your include folder is C:\Server\fltk-1.1.9\FL\
4. Your lib folder is C:\Server\fltk-1.1.9\include\
5. Go into C:\Server\fltk-1.1.9\vc2005\
6. Open fltk.sln
7. Compile as Debug
8. Compile as Release


9. Build your hello world.
(http://www.fltk.org/documentation.php/doc-1.1/basics.html)

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(300,180);
  Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
  box->box(FL_UP_BOX);
  box->labelsize(36);
  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  window->show(argc, argv);
  return Fl::run();
}


10. Configure the following in your project in Visual C++ Express 2008:

Tools > Options > Projects and Solutions > VC++ Directories >
  INCLUDE: C:\Server\fltk-1.1.9
  LIB: C:\Server\fltk-1.1.9\lib

Project > Project Properties > [Debug and Release] > Linker
    > Input > Additional Dependencies
  wsock32.lib fltk.lib comctl32.lib

1 comment:

Anonymous said...

Thanks MUCHO! for the comctl32.lib info. I also had to do a "/NODEFAULTLIB:"MSVCRT.lib" to get it to work. Now trying to get it to conpile/link with bjam.