GObjectTutorial
GObjectTutorial copied to clipboard
inheritence and parent class functions usage.
I am trying to compile the inheritence example and I have this:
gcc -Wall -o main `pkg-config --libs --cflags gobject-2.0` main.c point.c point3d.c
main.c: In function ‘main’:
main.c:10:31: warning: implicit declaration of function ‘point3d_get_x’ [-Wimplicit-function-declaration]
printf("x=%d, y=%d, z=%d\n", point3d_get_x(point3d), point3d_get_y(point3d), point3d_get_z(point3d));
^~~~~~~~~~~~~
main.c:10:55: warning: implicit declaration of function ‘point3d_get_y’ [-Wimplicit-function-declaration]
printf("x=%d, y=%d, z=%d\n", point3d_get_x(point3d), point3d_get_y(point3d), point3d_get_z(point3d));
^~~~~~~~~~~~~
/tmp/cca7uJeR.o: In function `main':
main.c:(.text+0x52): undefined reference to `point3d_get_y'
main.c:(.text+0x65): undefined reference to `point3d_get_x'
collect2: error: ld returned 1 exit status
make: *** [Makefile:2: main] Error 1
I was watching your example because I try to understand how to use the functions of a parent class (Point in your example) with an instance of a subclass (Point3D in your example) with GObject.
Thanks for your examples.