View Full Version : GTK, C issue
anti-net
October 22nd, 2006, 07:24 PM
I am trying out with GTK and C/C++ and i am trying some tutorials on www.gtk.org/tutorial but having some issues with gtk.h
I have had this problem before and I install libgtk2.0-dev(http://packages.ubuntu.com/dapper/libdevel/libgtk2.0-dev) which i was informed will sort my little problem but has't, not sure where to look now, Anyone able to help?
Thanks, Greg
Jessehk
October 22nd, 2006, 07:58 PM
You're are going to have to post the exact problems you're having in order for us to have any idea what the problem is.
anti-net
October 22nd, 2006, 08:21 PM
Opps Sorry the code I was trying was:
#include <gtk/gtk.h>
int main( int argc,
char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
gtk_main ();
return 0;
}
the errors I get when I compile it from Anjuta I get
"error: gtk/gtk.h"
"error: gtkWidget undeclared(first use in this function)
"error: (Each undeclared identifier is reported only once
"error: for each function it appears in.)
"error: 'window undeclard (first use in this function)
"error: 'GTK_WINDOW_TOPLEVEL' undeclared (frist use in this function)
I hope that is enough information to work out my problem.
po0f
October 22nd, 2006, 10:53 PM
anti-net,
What's the compiler command Anjuta is using to compile your program? And try this from the command line:
$ gcc -Wall `pkg-config gtk+-2.0 --cflags --libs` -o mybinary mysource.c
mike41
October 23rd, 2006, 07:46 PM
what is 'pkg-config'? How come without that cc option, it won't compile even though the header files are in fact in the include directory?
anti-net
October 23rd, 2006, 11:36 PM
I tryed what Po0f suggested and I get
gtk2.c: In function ‘main’:
gtk2.c:6: error: ‘gtkWidget’ undeclared (first use in this function)
gtk2.c:6: error: (Each undeclared identifier is reported only once
gtk2.c:6: error: for each function it appears in.)
gtk2.c:6: error: ‘window’ undeclared (first use in this function)
from GCC. ](*,)
High|ander
October 24th, 2006, 11:09 AM
paste the whole compiler output, not just the error
flerchjj
December 10th, 2007, 07:17 AM
I have 2 actions that worked for me:
1. Make sure the glib dev packages are installed.
2. In Anjuta o to Project->Properties->Packages
- add a module
- add the gtk package
Hope this helps
geirha
December 10th, 2007, 04:59 PM
I tryed what Po0f suggested and I get
gtk2.c: In function ‘main’:
gtk2.c:6: error: ‘gtkWidget’ undeclared (first use in this function)
gtk2.c:6: error: (Each undeclared identifier is reported only once
gtk2.c:6: error: for each function it appears in.)
gtk2.c:6: error: ‘window’ undeclared (first use in this function)
from GCC. ](*,)
It is called GtkWidget, not gtkWidget.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.