VirtualBox+Ubuntu18.04搭建Linux虛擬機運行環(huán)境
GTK
GTK+(GIMP Toolkit)是一套源碼以LGPL許可協(xié)議分發(fā)秒际、跨平臺的圖形工具包都毒。最初是為GIMP寫的纹因,已成為一個功能強大、設計靈活的一個通用圖形庫,是GNU/Linux下開發(fā)圖形界面的應用程序的主流開發(fā)工具之一。并且爸舒,GTK+也有Windows版本和Mac OS X版。它支持創(chuàng)建基于 GUI 的應用程序稿蹲,可以把 GTK+ 想像成一個工具包扭勉,從這個工具包中可以找到用來創(chuàng)建 GUI 的許多已經(jīng)準備好的構(gòu)造塊。
GTK+官方指南:http://zetcode.com/tutorials/gtktutorial/
GTK+的Wiki網(wǎng)址:http://en.wikipedia.org/wiki/GTK%2B
由于Ubuntu18已經(jīng)回歸到了主流Linux桌面gnome上苛聘,所以我們搭建gtk開發(fā)環(huán)境的時候涂炎,不需要再額外安裝gnome了。GTK的安裝流程:
1)安裝GNU編譯鏈接工具
? ??????sudo apt-get install build-essential
2)安裝gtk焰盗,可以使用如下指令同時安裝兩個版本gtk2和gtk3:
? ??????sudo apt-get install gnome-core-devel
如果安裝失敗璧尸,可以直接安裝gtk3咒林,命令如下:
? ??????sudo apt-get install libgtk-3-dev
3)安裝pkg-config用于自動查找gtk的頭文件位置
? ??????sudo apt-get install pkg-config
????????安裝完成后熬拒,可以使用以下命令來校驗安裝是否成功,并查看GTK+3.0所包含的所有頭文件以及庫的路徑:
????????pkg-config --cflags --libs gtk+-3.0
4)GUI驗證
使用官方給出的示例來測試是否能夠運行垫竞,Getting Started With GTK+澎粟,編譯指令如下:
????????gcc main.c -o main `pkg-config --cflags --libs gtk+-3.0`
完成之后打開可執(zhí)行文件運行查看效果:
特別說明:
如果下載安裝失敗,建議更換國內(nèi)軟件源:
#阿里云源
deb http://mirrors.aliyun.com/ubuntu/?bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/?bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/?bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/?bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/?bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/?bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/?bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/?bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/?bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/?bionic-backports main restricted universe multiverse
#網(wǎng)易源
deb http://mirrors.163.com/ubuntu/?bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/?bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/?bionic-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/?bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/?bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/?bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/?bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/?bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/?bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/?bionic-proposed main restricted universe multiverse
#搜狐源
deb http://mirrors.sohu.com/ubuntu/?bionic main restricted universe multiverse
deb hhttp://mirrors.sohu.com/ubuntu/?bionic-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/?bionic-backports main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/?bionic-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/?bionic-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/?bionic main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/?bionic-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/?bionic-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/?bionic-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/?bionic-proposed main restricted universe multiverse
#清華源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?bionic-proposed main restricted universe multiverse
#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/?bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/?bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/?bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/?bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/?bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/?bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/?bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/?bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/?bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/?bionic-proposed main restricted universe multiverse
參考鏈接:http://www.reibang.com/p/f2b87c33f434