简体   繁体   English

如何在Ubuntu上安装gtk开发依赖项?

[英]How to install gtk development dependencies on Ubuntu?

I have the code from GTK tutorial in base.c . 我在base.cGTK教程的代码。

I am working on Ubuntu and 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/run the program successfully? 作为Linux的新手,有人可以帮助我设置环境,以便我可以成功编译/运行程序吗?

$ 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可以提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM