fltk试用 (1)
先安装基本的库,用aptget可以自动安装依赖
sudo apt-get install libfltk1.1-dev libfltk1.1
下载一个最新的源代码,编译
tar avzf fltkxxx
cd fltkxxx
./configure
make
sudo make install
cutepig@ubuntu:~/Downloads/fltk-1.3.0$ sudo make install
=== installing FL ===
Installing include files in /usr/local/include...
=== installing jpeg ===
Installing ../lib/libfltk_jpeg.a in /usr/local/lib...
Installing jpeg headers in /usr/local/include/FL/images...
=== installing zlib ===
Installing libfltk_z.a in /usr/local/lib...
Installing zlib headers in /usr/local/include/FL/images...
=== installing png ===
Installing libfltk_png.a in /usr/local/lib...
Installing png headers in /usr/local/include/FL/images...
=== installing src ===
Installing libraries in /usr/local/lib...
=== installing fluid ===
Installing FLUID in /usr/local/bin...
=== installing test ===
Installing example programs to /usr/local/share/doc/fltk/examples...
=== installing documentation ===
Installing documentation files in /usr/local/share/doc/fltk ...
Installing man pages in /usr/local/share/man ...
cutepig@ubuntu:~/Downloads/fltk-1.3.0$
写一个例子程序
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
int main(int argc, char *argv[]) {
Fl_Window* w = new Fl_Window(330, 190);
new Fl_Button(110, 130, 100, 35, "Okay");
w->end();
w->show(argc, argv);
return Fl::run();
}
编译运行
g++ test.cpp -lfltk -lX11 -lm
参考网址
下载源代码
http://www.fltk.org/
入门文档
http://www.fltk.org/documentation.php/doc-1.1/basics.html#basics