Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   gtk header problem (http://www.programmingforums.org/showthread.php?t=13781)

melbolt Aug 17th, 2007 2:42 AM

gtk header problem
 
Hi guys, I am new to programming on linux, and I am having problems getting my first attempt at an app to compile. although I already have the lib-gtk2.0 library installed I keep getting this error when trying to compile my main.c file.

Here is the error I'm receiving...
"main.c:10:21: error: gtk/gtk.h: No such file or directory"

And here is what I have in my main...

:

  1. #ifdef HAVE_CONFIG_H
  2. #  include <config.h>
  3. #endif
  4.  
  5. #include <gtk/gtk.h>
  6.  
  7. #include "interface.h"
  8. #include "support.h"
  9.  
  10. int
  11. main (int argc, char *argv[])
  12. {
  13.   GtkWidget *BuddySelector;
  14.  
  15. #ifdef ENABLE_NLS
  16.   bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  17.   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  18.   textdomain (GETTEXT_PACKAGE);
  19. #endif
  20.  
  21.   gtk_set_locale ();
  22.   gtk_init (&argc, &argv);
  23.  
  24.   add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
  25.  
  26.   BuddySelector = create_BuddySelector ();
  27.   gtk_widget_show (BuddySelector);
  28.  
  29.   gtk_main ();
  30.   return 0;
  31. }


This of course is all generated by Glade so I'm assuming I am just missing some package or something?

thanks for taking a look at this for me.

btw: in case someone was curious, I'm working on a pidgin plugin, there was this plug-in called sendtosome in gaim that i really loved but it doesn't exist in pidgin so I decided to make it myself.

niteice Aug 17th, 2007 10:23 AM

What's your compilation command line?

melbolt Aug 17th, 2007 10:30 AM

If I recall correctly, I tried using both "gcc main.c" and "make main" and received the same error on both.

niteice Aug 17th, 2007 6:57 PM

you need to use pkg-config for gcc to find the headers:
:

gcc `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` main.c -o main
First pkg-config invocation gets the required compiler flags to find includes and whatnot, second tells it where to find the libraries to link against and which ones to use. the `` tells the shell to insert the output of the command inside at that location.

melbolt Aug 18th, 2007 5:22 AM

ah ok, I get what you're saying, using what you gave me and a bit more research, I managed to get it past the includes. There were other errors I received later but then I found a tutorial on glade and how you are supposed to run the autogen.sh executable file and then you are able to use a "make" command and it successfully spits out an executable file which will then launch the program created in the glade designer.

This works all well and good, I have my form with controls on it and callbacks handling what I need, the app runs great.

Here is my dilemma that maybe someone here can help me with...

I don't want what I created in glade to be built into an executable, I need it to be built into a .so file. The reason why is because, as I mentioned in a previous post, this is going to be a plug-in for the pidgin messenger client and in order to use it as a plug-in it must be built into a .so not an executable.

I know I could go the long way and not use glade to do all the form coding for me, but I'd rather not if I can avoid it, does anyone know a way to do this?


thanks a lot for the help.

melbolt Aug 18th, 2007 2:09 PM

sorry, to be more specific and to the point, I want glade to output a dynamic library or shared library. any idea how to do that?


All times are GMT -5. The time now is 2:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC