This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems include .h Eclipse ( Keil DS-5 )

Problems include .h Eclipse

I have a small program with # include <gtk/gtk.h>
This. H is in / home/Gabriel/workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0/gtk/gtk.h
This path is configured in properties-patches and symbols of three different ways in the order
/ Home/Gabriel/workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 /
/ Home/Gabriel/workspace/distribution/filesystem/armv5t_mtx/usr/include
/ Home/Gabriel/workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0/gtk/gtk.h
Despite this, still the msg
**** Build of configuration Default for project hello ****

make all
arm-none-linux-gnueabi-gcc-march = armv5te-c-O0-g hello.c-o hello.o
hello.c: 20: fatal error: gtk / gtk.h: No such file or directory
compilation terminated.
make: *** [hello.o] Error 1

Can anyone help?
Thanks in advance

Parents
  • Thank you, Sam!
    Solved with the following lines:
    CC_OPTS = -c -O1 -g \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/glib-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/cairo \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/pango-1.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/atk-1.0

    However, now I'm having the following errors:
    **** Build of configuration Default for project hello ****

    make all
    arm-none-linux-gnueabi-gcc hello.o -o hello
    hello.o: In function 'main':
    /home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main'
    collect2: ld returned 1 exit status
    make: *** [hello] Error 1

    You can help me here? Or should I open another post?

Reply
  • Thank you, Sam!
    Solved with the following lines:
    CC_OPTS = -c -O1 -g \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/glib-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/cairo \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/pango-1.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/atk-1.0

    However, now I'm having the following errors:
    **** Build of configuration Default for project hello ****

    make all
    arm-none-linux-gnueabi-gcc hello.o -o hello
    hello.o: In function 'main':
    /home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main'
    collect2: ld returned 1 exit status
    make: *** [hello] Error 1

    You can help me here? Or should I open another post?

Children
  • These are errors from the linker saying that it can't find the gtk libraries to link against. You'll need to modify the makefile to add appropriate -L and -l options when linking. -L<path> specifies a path in which libraries are located. -l<lib> specifies the name of a library to link against.

    The linking is performed near to be bottom of the makefile on this line:

            $(CC) $(OBJS) -o $(TARGET)
    

    You can either add the -L and -l options directly on this line, or define a new variable containing these options and add that new option to this line.

    Assuming you add the options to this line directly, you'll end up with something like:

            $(CC) $(OBJS) -o $(TARGET) -L -L"C:\Program Files\DS-5\examples\examples\DS-5Examples\ARMLinux\distribution\filesystem\armv5t_mtx\usr\lib" -lgtk-x11-2.0
    

    In this case, the name of the library on disk is libgtk-x11-2.0.so". However, the option to -l is the name of the library without the "lib" prefix and without the ".so" postfix.

    I don't have any familiarity with gtk, so can't advise which particular libraries are needed. I see that the included gnometris example uses gtk, so take a look at the Makefile included with that to see how that works.