我正在尝试编译一个包含来自/ usr / include目录中X11的各种文件的项目。它在远程linux机器上编译很好,但是当我尝试运行make文件时,我收到以下错误:
$ 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
但是,我知道文件存在的事实,我可以做到
$ cat /usr/include/X11/Xos.h
阅读文件。
这是我的make文件:
# 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
编辑:我已将make文件顶部的X11变量更改为/ usr / include而不是/ usr / X11R6。它没有任何区别。
编辑2:这是上述备选方案包含路径的错误。
$ 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
答案 0 :(得分:0)
您应该将X11 / Xos.h包括为:
#include&lt; X11 / Xos.h&gt;
如果您将其包含为:
#include“X11 / Xos.h”
将搜索相对于源文件,而不是-I目录。
这可能是个问题。