ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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'
[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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.