FLTK官方地址:https://www.fltk.org/index.php
fltk-1.1.10编译说明
打开visualc/fltk.dsw文件
编译fltk工程得到fltk.lib
编译hello工程,一个最简单的例子编译完毕
fltk-1.3.5编译说明
工程位置在ide/VisualC6/fltk.dsw
要依次编译fltk_zib,fltk_jepg,fltk_png
接下来fltk才可以编译,不会会报错,但改起来也比较简单
第一个问题,类中静态变量无法直接初始化(新的标准应该支持)
涉及文件Fl_Image.H,Fl_Device.H
Fl_Image.H中
class FL_EXPORT Fl_Image {
public:
static const int ERR_NO_IMAGE = -1;
static const int ERR_FILE_ACCESS = -2;
static const int ERR_FORMAT = -3;
......
}
修改为
class FL_EXPORT Fl_Image {
public:
static const int ERR_NO_IMAGE ;
static const int ERR_FILE_ACCESS ;
static const int ERR_FORMAT ;
......
}
并在Fl_Image.cxx文件中初始化
const int Fl_Image::ERR_NO_IMAGE = -1;
const int Fl_Image::ERR_FILE_ACCESS = -2;
const int Fl_Image::ERR_FORMAT = -3;
同样修改Fl_Device.H中内容
static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
修改为
static const int matrix_stack_size ;
static const int region_stack_max ;
并在Fl_Device.cxx中添加
const int Fl_Graphics_Driver::matrix_stack_size = FL_MATRIX_STACK_SIZE;
const int Fl_Graphics_Driver::region_stack_max = FL_REGION_STACK_SIZE - 1;
第二个问题,for循环中变量声明问题,一个位置不太好,一个被视为重复声明
fl_font_win32.cxx
for(unsigned ll = 0; ll < len; ll++) {
...
}
声明放到函数开始位置
unsigned ll = 0; //挪到函数开始位置
for(ll = 0; ll < len; ll++) {
...
}
l_gleam.cxx中 2个for循环中I被视为重复声明
for (int i = 0; i < h_top; i++, k -= step_size_top) {
...
}
...
for (int i = 0; i < h_bottom; i++, k -= step_size_bottom) {
...
}
修改为
int i=0;
for ( i = 0; i < h_top; i++, k -= step_size_top) {
...
}
...
for ( i = 0; i < h_bottom; i++, k -= step_size_bottom) {
...
}
fltk.lib编译成功
最简单的例子hello也可以编译成功