PDA

View Full Version : GTK+ question



bluezapper
April 4th, 2007, 09:00 AM
Hi all,

I am going to do programming in GTK+ using C programming language. I saw that there are two versions

GTK 1.2

GTK 2.0

I would like to know which version is more stable and better to use with lesser number of bugs.

thanks in advance,

bluezapper.:)

ndefontenay
April 4th, 2007, 09:26 AM
I think you should go for the GTK 2.0 because the 1.2 is getting old.

lnostdal
April 4th, 2007, 11:42 AM
Definitively go for 2.x.



sudo aptitude install gnome-core-devel build-essential


..should do it. Then use pkg-config (it is mentioned briefly in the GTK+ tutorial) to extract compile- and linker-flags.

bluezapper
April 5th, 2007, 12:24 PM
Hi Inostdal,

I installed the latest GTK+ version with the command you have mentioned.It installed many libraries. Now I face some problem,

Actually I am writing gnome applications. Previously, I wrote a program which uses GTK1.2 and it used to compile perfectly. Now, I started using GTK 2.x API

For example when I use



G_SIGNAL_CONNECT instead of GTK_SIGNAL_CONNECT I am getting the following errors:

/tmp/cc1KIdBt.o: In function `main':bluescangui.c:(.text+0xde): undefined reference to `G_CALLBACK'
:bluescangui.c:(.text+0xeb): undefined reference to `G_OBJECT'
:bluescangui.c:(.text+0x107): undefined reference to `g_signal_connect'
:bluescangui.c:(.text+0x113): undefined reference to `G_CALLBACK'
:bluescangui.c:(.text+0x120): undefined reference to `G_OBJECT'
:bluescangui.c:(.text+0x13c): undefined reference to `g_signal_connect'
collect2: ld returned 1 exit status

I am compiling using following commands. My program also uses some bluez libraries so

gcc -o bluescangui bluescangui.c -lbluetooth `gnome-config --cflags --libs gnomeui`

Can you tell me what I am doing wrong. I am not using any IDE just command line compilation and gedit.

regards and thanks in advance,

bluezapper.

bluezapper
April 5th, 2007, 01:59 PM
ok guys solved the problem.Replacing gnome-config with pkg-config solved the problem.

gcc -o bluescangui bluescangui.c -lbluetooth `pkg-config --cflags --libs libgnomeui-2.0`

thanks,

bluezapper.

j_g
April 5th, 2007, 08:53 PM
Don't forget the glade3 package. That's a tool to graphically create your user interface (ie, windows with menus, buttons, sliders, listboxes, etc).

Sluijsens
September 15th, 2009, 03:24 PM
can't acces tutorial anymore, gives an 404 error:O
My question, how do I use the pkg-config?
I'm am a total noob here:P
Installed Ubunto 9.04 just 2 days ago:)

Thanks

dwhitney67
September 15th, 2009, 04:27 PM
can't acces tutorial anymore, gives an 404 error:O
My question, how do I use the pkg-config?
I'm am a total noob here:P
Installed Ubunto 9.04 just 2 days ago:)

Thanks

pkg-config is executed from the shell. The most common options used are --cflags and --libs. Obviously one needs to specify the library package that they are interested in.

Note, not all libraries rely on the pkg-config feature; for those libraries, you will need to specify the header file path(s), if not /usr/include, and the library paths, if not /usr/lib (or /usr/local/lib), manually.

For include paths, use the GCC option -I. For library paths, use the -L option. Libraries are specified using the lowercase-l option, sans the "lib" and filename extension of the library. For example:


g++ -I/some/include/path MyFile.cpp -L/some/lib/path -lsome -o myapp

PmDematagoda
September 15th, 2009, 04:29 PM
Necromancy.

Thread closed.