glibconfig.h没有这样的文件或目录(glibconfig.h no such file or directory)(转,侵-->联-->删)
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>
But I have an error in 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 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 。把foo.c换成你要编译的文件即可
gcc `pkg-config --cflags glib-2.0` foo.c `pkg-config --libs glib-2.0`
在Raspbian系统上安装glib后,尝试用C语言读取配置文件时遇到`glibconfig.h: No such file or directory`的错误。解决方案是使用pkg-config工具,通过在编译命令中加入`pkg-config --cflags glib-2.0`和`pkg-config --libs glib-2.0`来正确链接glib的头文件和库路径。
645





