PDA

View Full Version : install GTK



NooBeee
April 7th, 2007, 04:34 PM
what would i apitude(can this be used as a verb?) if i want to start tinkering around with gtk+ with C?

sdrubolo
April 7th, 2007, 08:30 PM
sudo aptitude install gnome-core-devel build-essential

and then, here is a tutorial.
www.gtk.org/tutorial.

moreover, here there should be a post you may find interesting, http://ubuntuforums.org/showthread.php?t=400956

NooBeee
April 8th, 2007, 08:46 AM
i tried that but it didn't work--compiling a test helloworld file results in a unknown header error

gcc: pkg-config --cflags --libs gtk+-2.0: No such file or directory
gtk.c:1:21: error: gtk/gtk.h: No such file or directory
gtk.c: In function ‘main’:
gtk.c:6: error: ‘GtkWidget’ undeclared (first use in this function)
gtk.c:6: error: (Each undeclared identifier is reported only once
gtk.c:6: error: for each function it appears in.)
gtk.c:6: error: ‘window’ undeclared (first use in this function)
gtk.c:7: error: ‘label’ undeclared (first use in this function)
gtk.c:11: error: ‘GTK_WINDOW_TOPLEVEL’ undeclared (first use in this function)
gtk.c:17: error: ‘gtk_main_quit’ undeclared (first use in this function)
gtk.c:18: error: ‘NULL’ undeclared (first use in this function)
alvin@alvin-linuxbox:~$ gcc -o gtk gtk.c pkg-config --cflags --libs gtk+-2.0
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
cc1: error: unrecognized command line option "-fcflags"
cc1: error: unrecognized command line option "-flibs"

sdrubolo
April 8th, 2007, 07:25 PM
that's my same problem.
when you compile try this that should work
gcc -o helloworld helloworld.c `pkg-config --cflags --libs gtk+-2.0`

NooBeee
April 9th, 2007, 12:12 PM
lol....there was nothing wrong my gtk install.... i was tying a comma instead of the `

chihuonbk
October 11th, 2008, 07:06 AM
I am now facing the same problem,too. What was wrong? Or may be the command sudo aptitude install gnome-core-devel build-essential still not enough.

nvteighen
October 11th, 2008, 01:35 PM
I fear that's some obsolete method... or one that is applied from some other distro... whatever, I never had heard of such gnome-core-devel package before.

Use:


sudo apt-get install libgtk2.0-dev


(and also install "build-essential" if you haven't).

But also, I highly recommend you to install GTK+'s docs and the very nice GNOME's Devhelp documentation browser (which you will be able to access from Applications->Programming):


sudo apt-get install libgtk2.0-doc devhelp

jespdj
October 11th, 2008, 10:12 PM
You compile a GTK+ program like this:

gcc hello.c -o hello `pkg-config --cflags --libs gtk+-2.0`
Note the use of backticks ` instead of straight quotes '.

p0c4r1
March 17th, 2009, 05:55 AM
thanks nvteighen and jespdj...

its work now... :)

so install gtk in ubuntu:



sudo apt get install gnome-core-devel build-essential install libgtk2.0-dev libgtk2.0-doc devhelp