samedi 28 février 2015

Unnecessary class redefinition for FLTK


For some reason, the MSVC compiler gives the numeric definition of Fl_Button in the FLTK header file 'Enumerations.h' more precedence than a class of the same name. The following code failed to compile:



Fl_Button *confirm = new Fl_Button(0,0, 200, 50, "Hello world"));


Although, I have solved the problem by casting Fl_Button to its inherited class:



class Fl_Button_t : Fl_Button {};
Fl_Button_t *confirm = (Fl_Button_t*)(new Fl_Button(0,0, 200, 50, "Hello world"));


Is there a better approach for sorting out this name clash in the FLTK headers?




Aucun commentaire:

Enregistrer un commentaire