Advertisement

Compiling w/ gtkglext and gtk 2.4

Started by September 07, 2004 08:38 PM
4 comments, last by ontheheap 20 years ago
OK, I just installed a new version of gtk (2.4) so I could use gtkglext (which requires 2.0+). Everything installed ok, which is a good start at least!

gtkglext comes with a makefile to compile the example code and it works fine. I am able to compile and run all of the examples fine, which tells me I have everything set up ok.

BUT, I cannot figure out how to manually compile. I made a small change (just press space on an empty line) in one of the example source files (button.c) so I could run make again and send the output to a file named my.test.

Here is the contents of that file:


make[1]: Entering directory `/root/Desktop/Downloads/GTK2/gtkglext-1.0.6/examples'
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../gdk -I../gtk -DG_DISABLE_CAST_CHECKS -I/usr/X11R6/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/atk-1.0   -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED    -g -O2 -Wall -MT button.o -MD -MP -MF ".deps/button.Tpo"   -c -o button.o `test -f 'button.c' || echo './'`button.c; then mv -f ".deps/button.Tpo" ".deps/button.Po"; else rm -f ".deps/button.Tpo"; exit 1; fi
/bin/sh ../libtool --mode=link gcc  -g -O2 -Wall   -o button  button.o ../gdk/libgdkglext-x11-1.0.la ../gtk/libgtkglext-x11-1.0.la -lGLU -lGL  -L/usr/X11R6/lib -lXmu -lXt  -lSM -lICE -Wl,--export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   -lm 
gcc -g -O2 -Wall -o .libs/button button.o -Wl,--export-dynamic  ../gdk/.libs/libgdkglext-x11-1.0.so -L/usr/X11R6/lib ../gtk/.libs/libgtkglext-x11-1.0.so /root/Desktop/Downloads/GTK2/gtkglext-1.0.6/gdk/.libs/libgdkglext-x11-1.0.so -lGLU -lGL -lXmu -lXt -lSM -lICE /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libpangoxft-1.0.so /usr/lib/libpangox-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libgobject-2.0.so /usr/lib/libgmodule-2.0.so -ldl /usr/lib/libglib-2.0.so -lm
creating button
make[1]: Leaving directory `/root/Desktop/Downloads/GTK2/gtkglext-1.0.6/examples'


Here is an image of that text. Might be easier to read!

I have been trying to figure out how this is compiling the sources but nothing I try seems to work!

And one more thing, gtk-config is still pointing my my old version and I'm not sure how to fix this. What I want to do is have two gtk-config files (one named gtk-config, and one named gtk-config.old), but I'm confused as to how to make the nescesary changes! Please please help!

- Stephen

edit: added source tags

edit 2: added jpeg of output

OK, Well here is how I am trying to compile:


gcc gears.c -o bleh `pkg-config --libs gtk+-2.0` `pkg-config --cflags gtk+-2.0` -I/usr/X11R6/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/atk-1.0


Which gives me this error:


gears.c:18:23: gtk/gtkgl.h: No such file or directory
gears.c: In function `draw':
gears.c:174: error: `GdkGLContext' undeclared (first use in this function)
gears.c:174: error: (Each undeclared identifier is reported only once
gears.c:174: error: for each function it appears in.)
gears.c:174: error: `glcontext' undeclared (first use in this function)
gears.c:175: error: `GdkGLDrawable' undeclared (first use in this function)
gears.c:175: error: `gldrawable' undeclared (first use in this function)
gears.c: In function `reshape':
gears.c:237: error: `GdkGLContext' undeclared (first use in this function)
gears.c:237: error: `glcontext' undeclared (first use in this function)
gears.c:238: error: `GdkGLDrawable' undeclared (first use in this function)
gears.c:238: error: `gldrawable' undeclared (first use in this function)
gears.c: In function `init':
gears.c:264: error: `GdkGLContext' undeclared (first use in this function)
gears.c:264: error: `glcontext' undeclared (first use in this function)
gears.c:265: error: `GdkGLDrawable' undeclared (first use in this function)
gears.c:265: error: `gldrawable' undeclared (first use in this function)
gears.c: In function `main':
gears.c:434: error: `GdkGLConfig' undeclared (first use in this function)
gears.c:434: error: `glconfig' undeclared (first use in this function)
gears.c:468: error: `GDK_GL_MODE_RGB' undeclared (first use in this function)
gears.c:469: error: `GDK_GL_MODE_DEPTH' undeclared (first use in this function)
gears.c:470: error: `GDK_GL_MODE_DOUBLE' undeclared (first use in this function)
gears.c:519: error: `GDK_GL_RGBA_TYPE' undeclared (first use in this function)


So, I found out where gtkgl.h was hiding and add this to the compile options:


-I/usr/local/lib/gtkglext-1.0/include/


And now I get this oh-so-much-nicer printout:


/tmp/cc6qG1kh.o(.text+0x54): In function `gear':
: undefined reference to `glShadeModel'
/tmp/cc6qG1kh.o(.text+0x71): In function `gear':
: undefined reference to `glNormal3f'
/tmp/cc6qG1kh.o(.text+0x7e): In function `gear':
: undefined reference to `glBegin'
/tmp/cc6qG1kh.o(.text+0xd6): In function `gear':
: undefined reference to `sin'
/tmp/cc6qG1kh.o(.text+0xfb): In function `gear':
: undefined reference to `cos'
/tmp/cc6qG1kh.o(.text+0x10d): In function `gear':
: undefined reference to `glVertex3f'
/tmp/cc6qG1kh.o(.text+0x13a): In function `gear':
: undefined reference to `sin'
/tmp/cc6qG1kh.o(.text+0x15f): In function `gear':
: undefined reference to `cos'
/tmp/cc6qG1kh.o(.text+0x171): In function `gear':
: undefined reference to `glVertex3f'


etc etc etc...


I tried adding -lglut but it didnt help! I am extremely lost with how to get this work... I'm trying hard to figure it out and I really need help. I know whatever the makefile is doing is what I need to be doing, however the makefile is complex and I am having difficulty understanding exactly what is going on.


Here is a link to the makefile. Perhaps someone could at least help me make sense of it?


- Stephen

oh, and I would say *bump*, but there's never that many people on this forum!

Advertisement
meh... i've been playing around with this so much that i need to do a reinstall =( anyways, i found a post on linuxquestions.org with someone pointing out that it's fairly easy to read the source of gtkglext and implement by yourself.


double meh!


- Stephen
You should add -lGL -lGLU. I don't see you linking against the gtkglext also. Perhaps it comes with gtk libs automaticly.
gears.c:18:23: gtk/gtkgl.h: No such file or directory

It doesn't look like it's getting the header file it needs to compile.
Thanks for the replies. Actually, I have all of those suggestions and I still couldn't get it to work. I just reinstalled slack (it needed it anyways, ive been playing around with everything). I'm going to try and make my own opengl extension for gtk+. I think I'll learn a lot by trying to do it this way instead.

- Stephen

This topic is closed to new replies.

Advertisement