Results 1 to 3 of 3

Thread: glib.h: No such file or directory

  1. #1
    Join Date
    Jan 2009
    Beans
    323

    glib.h: No such file or directory

    hello,
    I met this problem when using following sentence:
    Code:
       #include <glib.h>
    According a previous thread, I have run folloiwng command:
    Code:
    sudo apt-get install libglib2.0-dev
    And this is my makefile:
    Code:
    run : jpg.o
    	gcc -o run jpg.o
    jpg.o : jpg.c regulator.c fprintf.c
    	gcc -c `pkg-config --libs glib-2.0` jpg.c
    clean :
    	rm run jpg.o
    the output of
    Code:
    pkg-config --libs glib-2.0

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,267
    Distro
    Kubuntu

    Re: glib.h: No such file or directory

    Fix this statement:
    Code:
    gcc -c `pkg-config --libs glib-2.0` jpg.c
    to be:
    Code:
    gcc -c `pkg-config --cflags glib-2.0` jpg.c
    when you are compiling.

    When you are linking your application (to build 'run'), then use the original pkg-config statement... you need that you get the library path.

    Basically...
    Code:
    run : jpg.o
    	gcc -o run jpg.o `pkg-config --libs glib-2.0`
    
    jpg.o : jpg.c regulator.c fprintf.c
    	gcc -c `pkg-config --cflags glib-2.0` jpg.c
    
    clean :
    	rm run jpg.o
    P.S. What is regulator.c and fprintf.c??
    Last edited by dwhitney67; June 23rd, 2009 at 03:43 PM.

  3. #3
    Join Date
    Jan 2009
    Beans
    323

    Re: glib.h: No such file or directory

    Quote Originally Posted by dwhitney67 View Post
    Fix this statement:

    P.S. What is regulator.c and fprintf.c??
    Yes, thank you. I am reading the man pkg-config. A little confusion at the difference between --cflags and --libs option.
    While, regulator.c and fprintf.c are just another file, which contain funtions that I would like to use in jpb.c.
    I am not familiar with code reuse in linux c. So, I use such a stupid method of just copy the regulator.c and fprintf.c here.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •