Linux 安装 gtk 和 glib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5275196/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 00:29:54  来源:igfitidea点击:

installing gtk and glib

linuxgtkglib

提问by tariq

hi every one kindly tell me how to install glib and gtk i am using ubuntu 10.04. i did;nt find any commands kindly tell me the procedure to install it

大家好,请告诉我如何安装 glib 和 gtk,我使用的是 ubuntu 10.04。我没有找到任何命令请告诉我安装它的过程

回答by fady mohamed osman

Simply type:

只需键入:

sudo apt-get install libgtk2.0-dev

glibis a dependency so it will be installed too. Also you might be interested in installing gladeas i remember it installs a gtkreference too:

glib是一个依赖项,所以它也会被安装。你也可能对安装感兴趣,glade因为我记得它也安装了一个gtk参考:

sudo apt-get install glade

回答by Marek

And once you install them with apt-get you can easily look up how are they called in your library list using the command:

一旦您使用 apt-get 安装它们,您就可以使用以下命令轻松查找它们在库列表中的调用方式:

pkg-config --list-all | grep query

pkg-config --list-all | grep query

You replace query with "glib" for example, in the result you can find:

例如,您将查询替换为“glib”,在结果中您可以找到:

glib-2.0 GLib - C Utility Library

glib-2.0 GLib - C Utility Library

So know when you compile your code and you want to link your library with pkg-config you can use the command like:

所以知道当你编译你的代码并且你想用 pkg-config 链接你的库时,你可以使用如下命令:

gcc -o example example.c pkg-config --libs --cflags glib-2.0

gcc -o 示例example.c pkg-config --libs --cflags glib-2.0