LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-26-2005, 01:03 PM   #1
abhishekgedam
LQ Newbie
 
Registered: Nov 2005
Posts: 14

Rep: Reputation: 0
GTK 2.0 problem


hi
i have fedora core 4 on my system. i want to use gtk. 2.0 to compile following code
file name :- gtk1.c
#include <gtk/gtk.h>

int main (int argc , char *argv[])
{
GtkWidget *window
gtk_init (&argc , &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();

return 0;
}
i use following command for compilation
$ gcc gtk1.c -o gtk1 `pkg-config -cflags -libs gtk+-2.0`

i get the following error
cannot find gtk.h

can any body help

Last edited by abhishekgedam; 11-26-2005 at 01:11 PM.
 
Old 11-26-2005, 01:19 PM   #2
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Try using this for the pkg-config part:

pkg-config --cflags --libs gtk+-2.0

Peace...
 
Old 11-26-2005, 01:23 PM   #3
abhishekgedam
LQ Newbie
 
Registered: Nov 2005
Posts: 14

Original Poster
Rep: Reputation: 0
hi tomdkat
Thanks for the reply, but i am not getting u, so please can u elobrate.
 
Old 11-26-2005, 01:25 PM   #4
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Ok, in your post above change this:

$ gcc gtk1.c -o gtk1 `pkg-config -cflags -libs gtk+-2.0`

to this:
$ gcc gtk1.c -o gtk1 `pkg-config --cflags --libs gtk+-2.0`

You need two dashes before "clfags" and "libs" to get the output you desire. Consider this:

Code:
tom@linux:~$ pkg-config -cflags -libs gtk+-2.0  
-cflags: unknown option
tom@linux:~$ pkg-config --cflags --libs gtk+-2.0
-I/opt/gnome/include/gtk-2.0 -I/opt/gnome/lib/gtk-2.0/include -I/opt/gnome/include/atk-1.0 -I/opt/gnome/include/cairo -I/opt/gnome/include/pango-1.0 -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include  -L/opt/gnome/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0  
tom@linux:~$
Give that a try.

Peace...
 
Old 11-26-2005, 02:12 PM   #5
abhishekgedam
LQ Newbie
 
Registered: Nov 2005
Posts: 14

Original Poster
Rep: Reputation: 0
Thumbs up

hi tomdkat
IT WORKS
Thank you very much
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gtk problem CMDR_PAIN Linux - Newbie 4 02-28-2006 10:37 AM
gtk+ 2.4.14 problem, how do I execute GTK? nautal Linux - Software 2 06-17-2005 06:09 PM
GTK 1.x Problem kule Slackware 1 04-02-2005 03:17 PM
gtk problem greenthing Linux - Software 3 03-19-2005 04:47 PM
GTK problem. help please. Blu-star Linux - Software 3 01-16-2004 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration