Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have never built a project in Ubuntu before and I am trying to come to grips with the GNU build tools and process.

When I try to make I get the glib.h - no such file or directory.

This is the output of pkg-config --cflags --libs glib-2.0

-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include  -L/usr/lib/i386-linux-gnu -lglib-2.0 

I presume the above output are the compiler flags make uses?

Any ideas?

share|improve this question
What software are you compiling - it may help us provide a more solid answer – Marco Ceppi Jun 14 '11 at 11:51

It appears that gcc can't find the glib.h which is a part of the libglib2.0-dev package. Make sure you've installed libgtk2.0-0-dev package (which depends on libglib2.0-dev) and try again.

share|improve this answer
I have libgtk2.0-dev installed. – SuperJumbo Jun 14 '11 at 2:33
emmm, I'm installed the libgtk2.0-0-dev library and not work, appear the message: glib-gprint.c:24:18: error fatal: glib.h: no such file or directory for any question I'm got xubuntu 11.10 – matias Dec 9 '11 at 13:24

You need add pkg-config --cflags --libs glib-2.0 in make file. It looks like this: gcc pkg-config --cflags --libs glib-2.0 file.c

share|improve this answer
tried adding that to the beginning and end of my Makefile, got something like this (only line number changes) both times: Makefile:17: *** missing separator. Stop. – boulder_ruby Feb 1 '14 at 20:46

You need to tell make to use pkg-config to find out the compiler flags. Like so

CFLAGS = `pkg-config --cflags glib-2.0` 
LDLIBS = `pkg-config --libs glib-2.0`

make will execute pkg-config and use the output to fill in CFLAGS and LDLIBS

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.