Compile code samples in 3 easy steps.
apt-get install libfltk1.3-dev libfltk1.3-compat-headers
g++ -lfltk -lfltk_images *.cpp
Headers were changed from "" to <> For instance: - #include "FL/Fl.H" + #include <FL/Fl.H>
Graph.cpp: In function ‘bool Graph_lib::can_open(const string&)’:
Graph.cpp:313:9: error: cannot convert ‘std::ifstream {aka std::basic_ifstream<char>}’ to ‘bool’ in return
return ff;
Fix:
\- return ff;
\+ return static_cast<bool>(ff);
Original code Color lcolor {(fl_color()}; gives warnings about narrowing unsigned int (the type returned by fl_color()) to int (the type of Color).
This hack works as long as you don't use RGB True Color see http://www.fltk.org/doc-1.3/drawing.html#drawing_colors
If you need RGB True Color, you'll have to find another fix or just disable warnings with: g++ -Wno-narrowing -lfltk -lfltk_images *.cpp
\- Color lcolor {(fl_color()};
\+ Color lcolor {static_cast<int>(fl_color())};
The C++11 standard does not allow "narrowing conversions" inside braced initialization lists, meaning conversions to a type with less precision or a smaller range, for example:
int i = 127;
char s[] = { i, 256 };
In the above example the value 127 would fit in char but because it's not a constant it is still a narrowing conversion. If the value 256 is larger than CHAR_MAX then that is also a narrowing conversion. Narrowing conversions can be avoided by using an explicit cast, e.g. (char)i.