Right up front - noob here and just learning Linux. I'm having trouble getting a simple C program to compile and must be missing something about how
#include and
gcc -I works...
I'm playing with Eclipse on the latest Debian and yes my "Hello World" program runs just fine. I wanted to play with D-BUS and didn't even make it past step 1 successfully which was simply adding
to my code, nothing else. (I believe I have all the proper DBUS packages installed for development).
After poking around I found how to add the path for the DBUS headers to Eclipse for gcc which resulted in:
Code:
-I/usr/include/dbus-1.0/dbus
when gcc is invoked. This seems to work fine as it eliminated the prior error of not finding dbus.h.
However now I get:
Code:
Invoking: GCC C Compiler
gcc -I/usr/include/dbus-1.0/dbus -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/hw.d" -MT"src/hw.d" -o "src/hw.o" "../src/hw.c"
In file included from ../src/hw.c:14:0:
/usr/include/dbus-1.0/dbus/dbus.h:29:34: fatal error: dbus/dbus-arch-deps.h: No such file or directory
compilation terminated.
make: *** [src/hw.o] Error 1
The file
/usr/include/dbus-1.0/dbus/dbus.h contains:
Code:
ifndef DBUS_H
#define DBUS_H
#define DBUS_INSIDE_DBUS_H 1
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-address.h>
#include <dbus/dbus-bus.h>
#include <dbus/dbus-connection.h>
#include <dbus/dbus-errors.h>
#include <dbus/dbus-macros.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-misc.h>
#include <dbus/dbus-pending-call.h>
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-server.h>
#include <dbus/dbus-shared.h>
#include <dbus/dbus-signature.h>
#include <dbus/dbus-syntax.h>
#include <dbus/dbus-threads.h>
#include <dbus/dbus-types.h>
#undef DBUS_INSIDE_DBUS_H
So some data points:
1) Of all the files listed above in dbus.h note that strangely only
dbus-arch-deps.h is
not in the /usr/include/dbus-1.0/dbus directory. That file is located in:
Code:
/usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus/dbus-arch-deps.h
2) Thinking there was a mistake installing the packages I made a sym link in the
/usr/include/dbus-1.0/dbus directory pointing to the actual file above. This didn't change anything. Being even more clever I simply copied the "missing" file to the directory but this also didn't result in anything.
3) I then added the path
/usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus to Eclipse but still get the same error:
Code:
Building file: ../src/hw.c
Invoking: GCC C Compiler
gcc -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus -I/usr/include/dbus-1.0/dbus -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/hw.d" -MT"src/hw.d" -o "src/hw.o" "../src/hw.c"
In file included from ../src/hw.c:14:0:
/usr/include/dbus-1.0/dbus/dbus.h:29:34: fatal error: dbus/dbus-arch-deps.h: No such file or directory
compilation terminated.
make: *** [src/hw.o] Error 1
(Note I've invokved gcc from the command line with the same options just to make sure it wasn't Eclipse).
4) Just for fun I commented out
#include <dbus/dbus-arch-deps.h> in
dbus.h however the "No such file or directory" error
occured again by simply moving on to the next file
dbus-address.h.
So my questions:
1) Why can't gcc find
bus-arch-deps.h when I include the path to it?
2) Why, even when I copy the actual file into the
/usr/include/dbus-1.0/dbus where dbus.h is located (and where I know gcc is looking) can it not find it?
3) Does this have anyting to do with perhaps needing
pkg-config? When I searched for this issue I found some stuff about that utility.
Ugh it's frustrating burning so much time on something I'm sure is simple. Thanks ahead of time for any help.