Search code examples
c++fltk

C++ Errror: "FL/Fl_xyz_Button.H: No such file or directory" in Fltk?


I'm new to C++ and Fltk. Guys this code is working fine:

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

int main(int argc, char **argv) {
    Fl_Window *window = new Fl_Window(800, 400);
    Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
    box->box(FL_NO_BOX);
    box->labeltype(FL_SHADOW_LABEL);
    Fl_Button *GG = new Fl_Button(150,90,40,30,"GG");
    GG->type(FL_NORMAL_BUTTON);

    window->end();
    window->show(argc, argv);
    return Fl::run();
}

but when I try this code (when using Fl_xyz_Button.H):

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

int main(int argc, char **argv) {
    Fl_Window *window = new Fl_Window(800, 400);
    Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
    box->box(FL_NO_BOX);
    box->labelfont(FL_BOLD+FL_ITALIC);
    box->labelsize(36);
    box->labelcolor(FL_WHITE);
    box->labeltype(FL_SHADOW_LABEL);
    Fl_xyz_Button *GG = new Fl_xyz_Button(150,90,40,30,"GG");
    GG->type(FL_NORMAL_BUTTON);

    window->end();
    window->show(argc, argv);
    return Fl::run();
}

it's show me error:

"FL/Fl_xyz_Button.H: No such file or directory"

and I see in /usr/local/include/FL doesn't have Fl_xyz_Button.H ?? How Can I fix it ? or download Fl_xyz_Button.H and put it inside /usr/local/include/FL folder?

I searched in that and there is no resault?

I use Xubutu(.deb) on Visual Studio Code.


Solution

  • xyz is just a placeholder name for one of the possible button types, check the documentation for available types and the corresponding header:

    • Fl_Button - A standard push button.
    • Fl_Check_Button - A button with a check box.
    • Fl_Light_Button - A push button with a light.
    • Fl_Repeat_Button - A push button that repeats when held.
    • Fl_Return_Button - A push button that is activated by the Enter key.
    • Fl_Round_Button - A button with a radio circle.