You should include X11/Xos.h as:
#include <X11/Xos.h>
If you include it as:
#include "X11/Xos.h"
it will be searched for relative to the source file, not in the -I directories.
That may be the issue.
Question
I'm trying to compile a project that includes various files from X11 in my /usr/include directory. It compiles fine on a remote linux machine, but when I attempt to run the make file I get the following error:
$ make clean; make
rm -f xrobot.o mobile_base.o arm.o eye.o object.o 4D_math.o Xkw/Canvas.o Xkw/Sli
der.o Xkw/Xkw.o lib/simulator.a *~
cd ./Xkw; make; cd ..; \
make[1]: Entering directory `C:/cygwin/home/Gene/roger/mmRogerSpring2014/RogerSi
mulator/Xkw'
gcc -c -g -I. -I/usr/include/X11 -I/usr/X11R6/include Canvas.c
Canvas.c:9:22: fatal error: X11/Xos.h: No such file or directory
compilation terminated.
make[1]: *** [Canvas.o] Error 1
make[1]: Leaving directory `C:/cygwin/home/Gene/roger/mmRogerSpring2014/RogerSim
ulator/Xkw'
gcc -c -g -I. -I/usr/X11R6/include -I/usr/include/X11 -I./include xrobot.c
In file included from xrobot.c:11:0:
Xkw/Xkw.h:12:27: fatal error: X11/Intrinsic.h: No such file or directory
compilation terminated.
make: *** [xrobot.o] Error 1
However, I know for a fact that the files are there, I can do
$ cat /usr/include/X11/Xos.h
And read the file.
Here is my make file:
# replace this with the top of your X11 tree
# X11 = /exp/rcf/share/X11R5
X11 = /usr/X11R6
############## do not change below this line ####################
ROGERINCDIR = ./include
XINCDIR = $(X11)/include
XLIBDIR = $(X11)/lib
EDLAB_XINCDIR = /usr/include/X11
XAWLIB = -lXaw
XMULIB = -lXmu
XTOOLLIB = -lXt
XLIB = -lX11
XEXTLIB = -lXext
MATHLIB = -lm
LIBS = -L$(XLIBDIR) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(XEXTLIB) \
$(MATHLIB)
RM = rm -f
CC = gcc
#CCFLAGS = -c -O $(OPT) -I. -I$(XINCDIR)
CCFLAGS = -c -g -I. -I$(XINCDIR) -I$(EDLAB_XINCDIR) -I$(ROGERINCDIR)
.SUFFIXES: .c .o
.c.o:
$(CC) $(CCFLAGS) $<
############## do not change above this line ####################
ROGERLIB = lib/simulator.a
OFILES1 = xrobot.o \
mobile_base.o \
arm.o \
eye.o \
object.o \
4D_math.o
XKWOFILES = Xkw/Canvas.o Xkw/Slider.o Xkw/Xkw.o
#XKWOFILES = Xkw/Canvas.o Xkw/Xkw.o
HFILES = Roger.h simulate.h control.h modes.h
all: subdirs $(OFILES1) $(ROGERLIB)
subdirs:
cd ./Xkw; make; cd ..; \
#$(ROGERLIB): $(OFILES1)
# $(CC) -o $@ $(OFILES1) $(XKWOFILES) $(LIBS)
$(ROGERLIB): $(OFILES1) $(XKWOFILES)
ar r $(ROGERLIB) $(OFILES1) $(XKWOFILES)
clean:
$(RM) $(OFILES1) $(XKWOFILES) $(ROGERLIB) *~
#mobile_base.o: Roger.h simulate.h control.h
#arm.o: Roger.h simulate.h control.h
#eye.o: Roger.h simulate.h control.h
#object.o: Roger.h simulate.h control.h
#xrobot.o: Xkw/Xkw.h Roger.h simulate.h control.h
#tele_interface.o: Roger.h simulate.h control.h modes.h
Edit: I've changed the X11 variable at the top of the make file to be /usr/include instead of /usr/X11R6. It made no difference.
Edit 2: Here's the error with the above mentioned alternative include path.
$ make clean; make
rm -f xrobot.o mobile_base.o arm.o eye.o object.o 4D_math.o Xkw/Canvas.o Xkw/Sli
der.o Xkw/Xkw.o lib/simulator.a *~
cd ./Xkw; make; cd ..; \
make[1]: Entering directory `C:/cygwin/home/Gene/roger/mmRogerSpring2014/RogerSi
mulator/Xkw'
gcc -c -g -I. -I/usr/include/X11 -I/usr/X11R6/include Canvas.c
Canvas.c:9:22: fatal error: X11/Xos.h: No such file or directory
compilation terminated.
make[1]: *** [Canvas.o] Error 1
make[1]: Leaving directory `C:/cygwin/home/Gene/roger/mmRogerSpring2014/RogerSim
ulator/Xkw'
gcc -c -g -I. -I/usr/include/include -I/usr/include/X11 -I./include xrobot.c
In file included from xrobot.c:11:0:
Xkw/Xkw.h:12:27: fatal error: X11/Intrinsic.h: No such file or directory
compilation terminated.
make: *** [xrobot.o] Error 1
No correct solution
OTHER TIPS
You should include X11/Xos.h as:
#include <X11/Xos.h>
If you include it as:
#include "X11/Xos.h"
it will be searched for relative to the source file, not in the -I directories.
That may be the issue.