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
Firstly, could you confirm if this is a makefile that you have written yourself or have obtained from elsewhere? If so, then editing the include paths in Eclipse has no effect and you'll need to edit the makefile directly. On the other hand, if this is a makefile that Eclipse is generating then setting the include paths in Eclipse should work, and so the following may help...
From the gcc command line you have pasted, it looks like the include paths you have set are not being passed to the compiler. Normally I would expect the include paths to be passed to the compiler using the -I <path> option.
For the version of DS-5 that I am using (build 472), this seems to work correctly. I added a new include path using the Includes tab in the project Properties dialog. Note that it is important that you add the new path under the "GNU C" language (the default is "Assembly Source File"). When I rebuild the project then the gcc command line now includes my new path with the -I option.
Thank you for the screenshots. I think I can see what is wrong. The new include paths you have added have an Eclipse icon next to them, which means they are relative to the Eclipse workspace. I suspect your include files are not in your workspace, and so you need to tell Eclipse to use an absolute path, rather than a workspace relative path.
To fix this, you will need to delete the include paths you've added and add them again. When clicking Add... to add the include paths, ensure that the "Is workspace path" box is unchecked; this means the path is absolute. When you do this, you should see the icon in the Paths and Symbols dialog for that include path changes from an Eclipse icon to something that looks like a tree. Then rebuild your project.
One, in case 3, the images depict my problem: www.pict.com/.../f4c42599b3 I'm using the latest version of the DS-5, Linux Fedora 12, the makefile is the project's Hello from examples.zip I am newbie, so do not expect much from me, be didactic, please
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!