LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 04-12-2005, 08:41 PM   #1
ndha
LQ Newbie
 
Registered: Jun 2003
Posts: 8

Rep: Reputation: 0
Problems with gtk programming


I write a simple program to learn using Gtk for GUI programming. My include files are in /usr/include/gtk-2.0/gtk/gtk.h. However, when I compile my program using gcc, I got a lot of errors as follow:

gtk-config: Command not found.
gtk-config: Command not found.
hello-gtk.c:1:21: gtk/gtk.h: No such file or directory
hello-gtk.c:3: error: syntax error before '*' token
hello-gtk.c: In function `QuitProg':
hello-gtk.c:5: warning: implicit declaration of function `gtk_main_quit'
hello-gtk.c:6: error: `FALSE' undeclared (first use in this function)
hello-gtk.c:6: error: (Each undeclared identifier is reported only once
hello-gtk.c:6: error: for each function it appears in.)
hello-gtk.c: In function `main':
hello-gtk.c:12: error: `GtkWidget' undeclared (first use in this function)
hello-gtk.c:12: error: `window' undeclared (first use in this function)
hello-gtk.c:13: error: `text_pane' undeclared (first use in this function)
hello-gtk.c:15: warning: implicit declaration of function `gtk_init'
hello-gtk.c:17: warning: implicit declaration of function `gtk_window_new'
hello-gtk.c:17: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
hello-gtk.c:18: warning: implicit declaration of function `gtk_widget_set_usize'
hello-gtk.c:19: warning: implicit declaration of function `gtk_window_set_title'
hello-gtk.c:19: warning: implicit declaration of function `GTK_WINDOW'
hello-gtk.c:20: warning: implicit declaration of function `gtk_container_set_border_width'
hello-gtk.c:20: warning: implicit declaration of function `GTK_CONTAINER'
hello-gtk.c:22: warning: implicit declaration of function `gtk_signal_connect'
hello-gtk.c:22: warning: implicit declaration of function `GTK_OBJECT'
hello-gtk.c:22: warning: implicit declaration of function `GTK_SIGNAL_FUNC'
hello-gtk.c:22: error: `NULL' undeclared (first use in this function)
hello-gtk.c:24: warning: implicit declaration of function `gtk_text_new'
hello-gtk.c:25: warning: implicit declaration of function `gtk_text_set_editable'
hello-gtk.c:25: warning: implicit declaration of function `GTK_TEXT'
hello-gtk.c:25: error: `FALSE' undeclared (first use in this function)
hello-gtk.c:26: warning: implicit declaration of function `gtk_container_add'
hello-gtk.c:27: warning: implicit declaration of function `gtk_widget_realize'
hello-gtk.c:28: warning: implicit declaration of function `gtk_text_insert'
hello-gtk.c:30: warning: implicit declaration of function `gtk_widget_show'
hello-gtk.c:33: warning: implicit declaration of function `gtk_main'

Please help me to get out of this !

Thanks a lot.
 
Old 04-12-2005, 09:54 PM   #2
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
Are you sure you have the GTK+ development libs and headers installed?
 
Old 04-12-2005, 11:13 PM   #3
ndha
LQ Newbie
 
Registered: Jun 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Yes, I do have GTK+ development libs and headers installed.
 
Old 04-12-2005, 11:20 PM   #4
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
Quote:
gtk-config: Command not found.
Gtk-config is for gtk 1.2. Use "pkg-config gtk+-2.0" instead.
 
Old 04-13-2005, 03:04 AM   #5
ndha
LQ Newbie
 
Registered: Jun 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks, now I got these msgs:

[ndha@hcmuns ~]$ gcc -Wall -g hello-gtk.c -o hello-gtk `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
hello-gtk.c: In function `main':
hello-gtk.c:24: warning: implicit declaration of function `gtk_text_new'
hello-gtk.c:24: warning: assignment makes pointer from integer without a cast
hello-gtk.c:25: warning: implicit declaration of function `gtk_text_set_editable'
hello-gtk.c:25: warning: implicit declaration of function `GTK_TEXT'
hello-gtk.c:28: warning: implicit declaration of function `gtk_text_insert'
hello-gtk.c:35: warning: control reaches end of non-void function
/tmp/ccegJfEf.o(.text+0x10b): In function `main':
/home/ndha/hello-gtk.c:25: undefined reference to `GTK_TEXT'
/tmp/ccegJfEf.o(.text+0x166):/home/ndha/hello-gtk.c:28: undefined reference to `GTK_TEXT'
collect2: ld returned 1 exit status

Thanks a lot !
 
Old 04-13-2005, 03:21 AM   #6
geminigal
Member
 
Registered: Apr 2005
Posts: 53

Rep: Reputation: 15
hi... m facing this errors too but in my coding.
/tmp/ccGDysIv.o(.text+0x65): In function `main':
: undefined reference to `gtk_widget_set_size_request'
/tmp/ccGDysIv.o(.text+0xa2): In function `main':
: undefined reference to `G_CALLBACK'
/tmp/ccGDysIv.o(.text+0xb3): In function `main':
: undefined reference to `G_OBJECT'
/tmp/ccGDysIv.o(.text+0x2d9): In function `main':
: undefined reference to `G_OBJECT'
/tmp/ccGDysIv.o(.text+0x2ea): In function `main':
: undefined reference to `G_CALLBACK'
/tmp/ccGDysIv.o(.text+0x2fb): In function `main':
: undefined reference to `G_OBJECT'
and
used to seeing this error: ld returned 1 exit status

Wat does this mean?
 
Old 04-13-2005, 03:29 AM   #7
geminigal
Member
 
Registered: Apr 2005
Posts: 53

Rep: Reputation: 15
in addition, i hd this error as well... kenot rectify the probs

: error: `GTK_STOCK_CLOSE' undeclared (first use in this function)


can somebody pls help!
 
  


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 programming sharapchi Programming 3 06-21-2005 02:22 PM
GTK programming geminigal Programming 1 06-02-2005 03:08 AM
Gtk programming geminigal Programming 2 05-11-2005 08:07 PM
Programming with GTK dfownz Programming 6 07-17-2004 01:50 PM
GTK and programming NSKL Programming 2 01-14-2003 03:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:56 PM.

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