Building FLTK on Windows with Code::Blocks

I'm having a lot of trouble getting FLTK to be compliant when I try to write code in Code::Blocks. I'm guessing this is because I downloaded/installed it incorrectly. I've tried to look for installation guides like

but I don't really know what it means. I've been obtaining my source files from here.

What I've tried so far is downloading the zipped folder and extracting it to my C++ folder, and then setting the IDE to search for directories in the fltk folder, but that doesn't work - I think it's a bigger problem than just looking for headers.

Can anyone with experience using FLTK point me in the right direction? Here is an example of the code used to create a simple window.

#include "Simple_window.h"  // get access to our windows library
#include "Graph.h"          // get access to graphics library facilities

int main()
    using namespace Graph_lib; // our graphics facilities are in Graph_lib

    Point tl(100,100);         // to become top left corner of window

    Simple_window win(tl,600,400,"Canvas"); // make a simple window

    Polygon poly; // make a shape (a polygon)

    poly.add(Point(300,200));     // add a point
    poly.add(Point(350,100));     // add another point
    poly.add(Point(400,200));     // add a third point

    poly.set_color(Color::red);   // adjust properties of poly

    win.attach(poly);             // connect poly to the window

    win.wait_for_button();        // give control to display engine

The headers in the program can be found here if you're interested.


Ok. You can't just unzip the darn thing into your folder. Install Cygwin, and select gcc4-g++ during the installation process (so that g++ and its dependencies are installed). Add Cygwin to your PATH (Right Click "My Computer" -> Properties -> Advanced -> Environment Variables, create an environment variable named "CYGWIN_HOME" with the value "C:\cygwin" or wherever cygwin is installed, edit the PATH environment variable and append ";%CYGWIN_HOME%\bin;%CYGWIN_HOME%\sbin;%CYGWIN_HOME%\usr\bin;%CYGWIN_HOME%\usr\sbin"). Direct Code::Blocks to use Cygwin's version of g++. Download and extract FLTK to anywhere. In that folder, run "./configure" then "make" then "sudo make install". Execute "fltk-config --cflags", and setup Code::Blocks to add those flags to the default compiler flags. Execute "fltk-config --ldflags" and direct Code::Blocks to add the output of that command to the default linker flags.

What Michael said, though you can also compile the library using Visual Studio. If you look in the fltk directory, you'll see a directory called visualc. In there is a file called fltk.dsw. Open that up in Visual Studio, build the project, and you should be good to go. If you're using Visual Studio 2005 or later, you want vc2005/fltk.sln instead.

The README file in the directory you unzipped fltk into mentions this.

Need Your Help

How do I get column names to print in this C# program?

c# datatable datarow datacolumn

I've cobbled together a C# program that takes a .csv file and writes it to a DataTable. Using this program, I can loop through each row of the DataTable and print out the information contained in ...

Would I benefit from applying move semantic or return-value-optimization will be performed for function that returns file content as string?

c++ move-semantics return-value-optimization

I have some load(..) method that loads the file's content into std::wstring. It usually process quite big files (up to few MB) and I use it extensively so I look for optimization possibilities (wit...