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

问题描述:

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

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

#include <glib.h> 

但是我在gtypes.h中有一个错误

But I have an error in gtypes.h

fatal error:glibconfig.h No such file or directory

我使用了这条路径

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

我添加了

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

我在教程中阅读过.我还必须声明

as I read in this tutorial. 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?

使用pkg-config.

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