We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
All paths are absolute, unless one also puzzles me that in the Outline tab, the include gtk / gtk appears as if it were found, is in blue, then the absolute path to it, gtk / gtk, not listed Includes the Project Explorer. Even if I double click on gtk / gtk Outline tab, it opens the correct include
It looks like you are extending the pre-supplied hello project. This project comes with a pre-configured makefile, and any changes you make in Eclipse are used only for navigation and searching in the GUI and are not used when compiling.
Look in the Project Explorer and open the file called "Makefile". Near to the top you will find a line such as:
CC_OPTS = -c -O1 -g
Add your include paths to this line using the -I option, for example:
CC_OPTS = -c -O1 -g -I/home/Gabriel/workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0/
Save this file and rebuild the project.
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?
that sounds like an eminently sensible way to proceed with any new environment!
"This project comes with a pre-configured makefile, and any changes you make in Eclipse are used only for navigation and searching in the GUI and are not used when compiling."
That sounds like a really dumb and unhelpful thing to do!
As noted above, surely it is natural - even to be encouraged - for a new user to start with the supplied "Hello" project and work from there?!
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.
There are two types of projects in Eclipse: managed projects in which Eclipse autogenerates a makefile based on the settings in the GUI, and imported makefile projects in which it is your responsibility to maintain the makefile manually. The examples supplied with DS-5 come with manually written makefiles. We will consider providing managed projects for the examples instead of or as well as makefiles in a future release.
I don't know much about Makefile, but it seems that, the targeted users of DS-5 are not been decided?
Problem solved! Thanks to all!