简体   繁体   中英

How do I install FLTK for VS2010?

I'm doing a project for school have to incorporate a form of GUI. Sadly, I have no experience with GUIs whatsoever so I just spend the last few hours comparing the various toolkits and settled on FLTK for it's lightweightness. I also spent the time attempting to install FLTK by reading various guides but to no avail.

I was wondering if anyone could tell me what to do step-by-step. Thanks in advance

BTW I am using Visual Studio 2010 Professional with Windows 7

First you should download fltk from the website,( it may be .zip or .tar). I have downloaded fltk1.3.x...)

Then you extract it, open the folder and look for a file with extension .dsw . (mine was in a folder called ide). This file will open a Visual Studio Solution.

It will probably ask you to upgrade the solution to the current version of Visual Studio. Say yes to all.

When the project opens, click build/build solution. It takes some time to be built.

Then from the lib folder copy the .lib files (except readme.lib) to the folder ProgramFilesx86/MicrosoftVisualStudio10/VC/lib .

Then copy FL folder into the ProgramFilesx86/MicrosoftVisualStudio10/VC/include .

installation is over... for more details you can read programming principles and practice using c++ by Stroustrup.

I have a blog posting that shows you how.

It was done in VS2003 but the same instructions on there have been seen to work equally as well in VS2010.

After installing, unzipping and building the fltk download , you should make sure that the following things are taken care of in your project properties:

  1. Add the required additional include directories.
  2. In the Project Properties -> Linker -> Input -> Additional Dependencies, ensure the {fltkd, wsock32, comctl32}.lib libraries have been included.
  3. In the Project Properties -> Linker -> General -> Additional Library Directories, ensure the correct path for the fltk library files is given.
  4. In the Project Properties -> C/C++ -> Code Generation -> Runtime Library field, make sure the “Multi-threaded Debug DLL (/MDd)” field is chosen.

You should then be in a position to try a simple example such as the following "Hello World" sample:

#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();  
} 

A decade ago Greg Ercolano made a video about how to setup Visual Studio 7 project that uses FLTK. Take a look at his excellent (FLTK related) videos . The process should not be much different with any newer Microsoft(R) VisualStudio(TM). Also, I highly recommend taking a look at Greg's " FLTK Cheat Sheet " page.

I understand that this question is old, but...

Now FLTK can be installed directly via NuGet. No need to do anything manually.

https://blogs.msdn.microsoft.com/vcblog/2015/02/13/find-your-favorite-library-for-c-in-nuget/

Just search "FLTK" using the NuGet Package Manager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM