extra X libs dependencies in a simple glib mainloop



Hi,
I was trying out a simple glib mainloop, and the following
program runs fine in X or without X. However, doing
an ldd on the executable, it lists 20 or more X-related
libraires.

Can you compile a glib program so it dosn't require the X libs?

Also, why dosn't this compile it? Using just glib in pkgconfig?
gcc  -o test  test.c  `pkg-config --cflags --libs glib-2.0`

but this does
gcc  -o test  test.c  `pkg-config --cflags --libs gtk+-2.0`

The simple loop:

------------------  snip ------------------------------------

#include <glib/gmain.h>
#include <stdio.h>

GMainLoop* loop;
int i;

gboolean  callback () {
     printf("%d\n",i  );
     i++;
    
     if( i > 10 ){
         g_main_loop_quit(loop);
        return FALSE;
      }
      
  return TRUE;
 }
 

int main() {
 loop = g_main_loop_new( NULL, TRUE) ;  

 g_timeout_add(500, callback, NULL);

 g_main_loop_run(loop);
 return 0;
 }
-----------------  snip --------------------------------


Thanks,
zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]