Linux glibconfig.h 没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17360635/
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-06 23:20:50  来源:igfitidea点击:

glibconfig.h no such file or directory

clinuxcodeblocksglib

提问by dali1985

I just installed glib in Raspbian(Debian version). I want to read a config file using glib. I am trying to write a C application in Codeblocks and I use the header

我刚刚在 Raspbian(Debian 版本)中安装了 glib。我想使用 glib 读取配置文件。我正在尝试在 Codeblocks 中编写一个 C 应用程序,并且我使用了标头

#include <glib.h> 

But I have an error in gtypes.h

但是我在 gtypes.h 中有错误

fatal error:glibconfig.h No such file or directory

I used this path

我用过这条路

project->Build Options->Compiler Settings->Other Options 

and I added

我补充说

-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include

as I read in thistutorial. I have to declare also

正如我在教程中读到的那样。我也必须声明

-L/usr/lib -lm -lglib-2.0 

as the tutorial says and if yes then where and how can I declare it in Codeblocks?

正如教程所说,如果是,那么我在哪里以及如何在代码块中声明它?

采纳答案by mattn

Use pkg-config.

使用pkg-config.

gcc `pkg-config --cflags glib-2.0` foo.c `pkg-config --libs glib-2.0`