pkg-config 自动补全 C 编译库依赖

pkg-config 是一个在源代码编译时查询已安装的库的使用接口的计算机工具软件。 工作原理 其工作原理如下: 当安装一个库时(例如从RPM,deb或其他二进制包管理系统),会包括一个后缀名为 pc 的文件,它会放入某个文件夹下(依赖于你的系统设置)。 例如,在 Linux 为该软件的库文件所在文件夹 lib 之下的子文件夹 pkgconfig 。 并把该子文件夹加入 pkg-config 的环境变量 PKG_CONFIG_PATH 作为搜索路径,例如在 bash 配置文件中加入一行: ...

January 5, 2023 | 2 分钟 | 614 字 | Tianlun Song

根本解决C程序 ignoring return value of ‘***’

最近在移植一个 C 项目时出现如下报错: xxxxxx.c:990:4: error: ignoring return value of ‘chroot’, declared with attribute warn_unused_result [-Werror=unused-result] 990 | chroot("/"); 之所以报错等级为 Error ,是因为 GCC 编译具有参数 -Werror,将警告当作错误: ...

November 2, 2022 | 1 分钟 | 219 字 | Tianlun Song