LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-15-2010, 04:19 AM   #1
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
error: gtk/gtk.h: No such file or directory


Below is my C code:
Code:
#include <gtk/gtk.h>
int main ()
{
     return 0;
}
Below is the compilation output of this code !
Code:
anisha@linux-p0mg:~> gcc -I/usr/include/gtk-2.0/gtk/ j.c
j.c:1:21: error: gtk/gtk.h: No such file or directory
The most relevant packages I have installed are listed below:
Quote:
gtk2
gtk2-devel
gtkmm2
gtkmm2-devel
wxGtk
wxGtk-devel
Have I missed something out ?

Kindly guide !

Last edited by TheIndependentAquarius; 03-15-2010 at 04:20 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-15-2010, 04:27 AM   #2
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Bangalore, India
Distribution: Linux Mint 13
Posts: 590

Rep: Reputation: 64
May be you need to install gtk+ and libgtk+, I'm not sure though.
 
Old 03-15-2010, 06:36 AM   #3
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Original Poster
Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Quote:
Originally Posted by sayan_acharjee
May be you need to install gtk+ and libgtk+, I'm not sure though.
That didn't help, BUT THANKS FOR BOTHERING TO REPLY,

I managed to solve the problem myself:
Here's my solution:

I had compiled it wrongly first of all !

Correct way:
Code:
gcc -I/usr/include/gtk-2.0/ j.c
This resulted in many other errors like unable to find
glib.h, gtk.h, glib.h, glibconfig.h, pango.h, gdkconfig.h, atkobject.h, pkgconfig.h


Then I did the following:
Code:
export CPATH=$CPATH:/usr/include/gtk-2.0
export CPATH=$CPATH:/usr/include/glib-2.0/
export CPATH=$CPATH:/usr/lib/glib-2.0/include/
export CPATH=$CPATH:/usr/include/pango-1.0/
export CPATH=$CPATH:/usr/lib/gtk-2.0/include/
export CPATH=$CPATH:/usr/include/atk-1.0/
and then installed gdk-pixbuf and gdk-pixbuf-devel packages !

and now I can compile it simply like this: gcc j.c

Last edited by TheIndependentAquarius; 03-15-2010 at 06:47 AM.
 
Old 03-15-2010, 07:25 AM   #4
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Bangalore, India
Distribution: Linux Mint 13
Posts: 590

Rep: Reputation: 64
Thanks for sharing the solution
 
Old 03-15-2010, 07:28 AM   #5
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Original Poster
Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Most welcome
 
Old 03-03-2011, 09:29 AM   #6
leibnix
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 2
I'm also starting out with gtk now. I struggled a lot with compiling hello-world until I found the 'GNOME Documentation Library'.

Basically, the pkg-config utility can produce all (or most of) the include options you need for compiling. try typing:

Code:
pkg-config --libs gtk+-2.0
To compile hello.c with gtk2.0, just type:

Code:
gcc `pkg-config --cflags --libs gtk+-2.0` hello.c -o hello
Note the fancy backticks. They work somewhat like quotes in lisp and expands the output from the pkg-config program into the your command.

I guess this means less cluttering of the environment, and you can easily change the 2.0 to 3.0 without rewriting all your scripts.

thanks,
tor
 
2 members found this post helpful.
Old 03-28-2011, 04:17 AM   #7
houqi
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
Smile I met the same problom that you countered,but resolved it

Actually,it's simple to resole,though it confused me a whole day.
Noting,there is diference between " ' " and " ` "," ' " is single quotes,the other symbol shares the key with "~".
The correct symbol is last one that shared the key with "~".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Inhibit GTK verbose messages when running GTK/Gnome applications from terminal d1s4st3r Linux - Software 1 11-10-2009 10:33 PM
Freerock uninstall stole GTK looking for up-to-date pango, atk, gtk, glib and xft tgz Oholiab Slackware 8 09-18-2005 11:57 AM
cant find gtk-config file or gtk-devel to install happychappy Linux - Software 2 02-16-2005 12:46 AM
GTK error when starting gtk-chtheme Dswissmiss Linux - Software 1 10-01-2004 11:53 PM
compiling gaim/ gtk error (two versions of gtk) webazoid Linux - Software 0 07-06-2004 06:05 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration