Ubuntu安装FLTK详细过程

1.官网下载源码压缩包。版本建议最新,我这里的版本是1.3.8

2. 终端输入:sudo apt-get install build-essential xorg-dev libx11-dev libcairo2-dev

//此步骤必要!!!安装依赖库,不然后面安装总会出错!!!

3.挤压文件: tar -xvf fltk .tar.gz

4.进入源文件:cd fltk-1.3.8/

5.修改先关配置,比如我需要OpenGL支持,默认的是不支持,我就改成支持。按照你们的需要修改即可。修改方式为:./configure + options

./configure --enable-debug --enable-gl --enable-shared --enable-threads --enable-xdbe --enable-xft

相关参数有:

--enable-cygwin

                Enable the Cygwin libraries under WIN32

--enable-debug

                Enable debugging code & symbols

--disable-gl

                Disable OpenGL support

--enable-shared

                Enable generation of shared libraries

--enable-threads

                Enable multithreading support

--enable-xdbe

                Enable the X double-buffer extension

--enable-xft

                Enable the Xft library for anti-aliased fonts under X11

--bindir=/path

                Set the location for executables [default = $prefix/bin]

--datadir=/path

                Set the location for data files. [default = $prefix/share]

--libdir=/path

                Set the location for libraries [default = $prefix/lib]

--includedir=/path

                Set the location for include files. [default = $prefix/include]

--mandir=/path

                Set the location for man pages. [default = $prefix/man]

--prefix=/dir

                Set the directory prefix for files [default = /usr/local]

6.make

7.安装:sudo make install

8.测试安装是否成功:

1.vim hello.cpp

hello.cpp的代码为:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main(int argc, char **argv) {
    Fl_Window *window = new Fl_Window(340,180);
    Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
    box->box(FL_UP_BOX);
    box->labelfont(FL_BOLD+FL_ITALIC);
    box->labelsize(36);
    box->labeltype(FL_SHADOW_LABEL);
    window->end();
    window->show(argc, argv);
    return Fl::run();
}

2.编译:fltk-config --compile hello.cpp

3.运行:./hello

**over** 

参考文章:1 - Introduction to FLTK

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值