samedi 22 janvier 2022

How does one use FLTK library using Bjarne's GUI's header file in his book Programming principles and practices?

#include "Simple_window.h"
#include "Graph.h"

int main()
{
    using namespace Graph_lib;

    Point tl(100, 100);

    Simple_window win(tl, 600, 400, "Canvas");

    Polygon poly;

    poly.add(Point(300, 200));
    poly.add(Point(350, 100));
    poly.add(Point(400, 200));

    poly.set_color(Color::red);

    win.attach(poly);

    win.wait_for_button();
}

The above code has to create a GUI window with a shape rendered on its canvas but it does not run the way it should throwing errors like ambiguous windows specified, no Point type found even though all the libraries and header files are properly placed as specified in the book. I also tried commenting and uncommenting certain parts of the supporting GUI library from Bjarne's site as done by others and also reading some of the error messages but of no use. It keeps throwing ambiguous windows specified error!

Right now my only aim is to run the code above on my machine.

Aucun commentaire:

Enregistrer un commentaire