如何使用 gcc 包含所需的 C 库? [英] How to include needed C library using gcc?

查看:36
本文介绍了如何使用 gcc 包含所需的 C 库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从这个 教程 Ubuntu 上使用 gcc.我必须使用什么作为 gcc 的参数来包含 #include <libappindicator/app-indicator.h> 所需的库?

I am trying to compile the simple C example from this Tutorial on Ubuntu using gcc. What do I have to use as argument for gcc to include the needed libraries for #include <libappindicator/app-indicator.h>?

推荐答案

如果你使用了apt-getSynaptic Package Manager 等来获取appindicator 库(相对于从源代码构建),您是只安装了 libappindicator1 包还是安装了 libappindicator-dev 获取libappindicator 头文件?Linux 包经常将运行时库与编译时头文件分开.这样,只需要库来满足动态链接的人就不必安装不需要的头文件.但是由于您正在进行开发,因此您需要这些头文件,因此也需要 libappindicator-dev 包.

If you used apt-get, Synaptic Package Manager, etc. to get the appindicator library (vs. building it from source), did you only install the libappindicator1 package or did you also install libappindicator-dev to get the libappindicator header files? Linux packages very often have split the runtime libraries from the compile-time headers. That way people who only need the libraries to satisfy a dynamic link don't have to install unneeded headers. But since you're doing development you need those headers and therefore need the libappindicator-dev package as well.

这篇关于如何使用 gcc 包含所需的 C 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆