C语言 如何在 Ubuntu 上安装 gtk 开发依赖项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15390181/
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
How to install gtk development dependencies on Ubuntu?
提问by Kraken
I have the code from GTK tutorialin base.c.
我从代码GTK教程在base.c。
I am working on Ubuntuand when I compile using
我在Ubuntu 上工作,当我编译时使用
$ gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0`
I get the following error
我收到以下错误
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
base.c:1:20: fatal error: gtk/gtk.h: No such file or directory compilation terminated.
Being new to linux, can someone help me in setting up the environment so that I can compile/runthe program successfully?
作为linux新手,有人可以帮助我设置环境以便我可以成功编译/运行程序吗?
回答by poolie
$ sudo apt-get install libgtk2.0-dev
Generally speaking to build things based on libfoo, you need libfoo-dev.
一般来说,构建基于的东西libfoo,你需要libfoo-dev。
In addition, to install anything that is needed to build a package, say gedit, you can run:
此外,要安装构建包所需的任何东西,例如gedit,您可以运行:
$ sudo apt-get build-dep gedit
Searching http://packages.ubuntu.com/or Synaptic can help.
搜索http://packages.ubuntu.com/或 Synaptic 会有所帮助。

