C, pkg-config, conflicting header locations
I've never come across this before, but I'm using pkg as follows:
Code:
`pkg-config --cflags --libs gtk+-2.0 libgnome-2.0 gnome-desktop-2.0` Code:
#include <libgnome/libgnome.h> Code:
main.c:5:31: error: libgnome/libgnome.h: No such file or directory Here are the two files I need: Code:
./libgnome-2.0/libgnome/libgnome.h |
You failed to post how you were compiling your source file, nor did you post the output given by the pkg-config command.
If you are using a Makefile, at a minimum it should look something like: Code:
APP = MyApp P.S. I am assuming you have the gtk+-2.0, libgnome-2.0, and gnome-desktop-2.0 development packages installed on your system. |
#include <header>
means : look in '/usr/include/' for the header. ( And in other include path's ). So I guess you will have to write : #include <libgnome-2.0/libgnome/libgnome.h> #include <gnome-desktop-2.0/libgnome/gnome-desktop-item.h> EDIT : See post # 2 for correct solution. ..... |
Quote:
|
Sorry, I'm compiling from the CLI, not through a makefile. However, for a temporary fix, I've just specified the absolute location of both the header files.
I'm assuming that this issue has been addressed by gnome devs, if you check the GIT tree repositories for gnome (http://git.gnome.org/cgit/gnome-desktop/tree/), and check under "gnome-desktop", you might notice there's no longer a "libgnome" directory, so instead of "./libgnome/gnome-desktop.item.h" the header location would be "./libgnome-desktop/libgnome/gnome-desktop-item.h". Which I assume would correct the problem, now that there are two distinct paths to each header. For reference, here's the output of pkg-config: Code:
pkg-config --cflags --libs gtk+-2.0 libgnome-2.0 gnome-desktop-2.0 Quote:
Quote:
|
1 Attachment(s)
Try to use the Makefile I provided earlier, because I think you are doing something fundamentally wrong; there is no reason I can think of that would preclude GCC from finding the distinct headers files.
For the Makefile I provided earlier, copy/paste it to a file called Makefile (using your favourite editor), then save it. If you are not familiar with Makefiles, then one thing you must be aware of is that the statements that follow the entry-points of the Makefile must be preceded with a tab-space... not regular white-space. To prove that GCC does not have trouble finding two distinct header files, I have attached a small project that employs a Makefile to compile a simple app that includes two header files: one in include/one/same, the other in include/two/same. All I had to provide GCC was a -I./include/one and a -I./include/two. The main.c program looks like: Code:
#include <same/headerOne.h> P.S. Because LQ limits to which type of attachment I can include, the attached file is actually a tar-ball. After downloading it, go to the folder where it is, and run these commands: Code:
tar xvf foo.txt |
All times are GMT -5. The time now is 09:33 PM. |