使用make(Linux)编译期间找不到头文件

时间:2013-06-20 05:57:10

标签: linux makefile

我在make期间遇到以下错误:

In file included from modGPRS.c:25:
../inc/intModGPRS.h:33:21: error: datapkt.h: No such file or directory

目录结构如下: datapkt.h位于main_proj/libs/ipsec/itf

libs文件夹有一个Makefile,如下所示:

include $(BUILD_TOP)/build_control/stream/config.mk

SUBDIRS = tracing config stats srandom

SUBDIRS_$(B_HAS_EEPROM) += eeprom
SUBDIRS_$(B_LIBARCHIVE) += libarchive
ifeq ($(B_PLATFORM_openat),y)
    SUBDIRS += openat openssl asn1c mib zlib diff ipsec
else
    SUBDIRS += iniparser daemon ipsec
endif

stats_needs      = config

include $(BUILD_TOP)/build_control/stream/subdirs.mk

ipsec的Makefile如下:

SDIRS += src itf
TOP?=..
RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
                    (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
                    $(MAKE) -e TOP=$(TOP)/.. $$target INCLUDES='$(INCLUDES)') || exit 1; \
                done;

subdirs:
        @target=all; $(RECURSIVE_MAKE)

all: subdirs -I /itf

include $(BUILD_TOP)/build_control/stream/subdirs.mk

另外s ubdirs.mk如下:

#   This is a stand-alone file to distribute targets to
#   sub-directories. Include this file alone.  

#  Make bug: It loses track of if/endif over a $(eval) call.
ifndef __subdirs_include
__subdirs_include = yes

#   This only works for the standard targets defined in $(TARGETS)
#   in utils.mk. However this list can be extended with +=.

install:: install-hdrs

include $(BUILD_TOP)/build_control/stream/utils.mk
include $(BUILD_TOP)/build_control/stream/platform.mk

#  This creates a recursion rule for each pair of target and subdirectory.
#  The target for doing T in directory D is named T+D. 
#  If there is a "$(D_needs) = subdirs" then the subdirs become prerequisites
#  of D.
define __target_subdir
.PHONY:: $(1)+$(2)
$(1)+$(2) :: $(3); +$(MAKE) -C $(2) $(1)
endef

$(foreach t,$(TARGETS),\
    $(foreach d,$(strip $(SUBDIRS) $(SUBDIRS_y)),\
        $(eval $(call __target_subdir,$(t),$(d),$(patsubst %,$(t)+%,$($(d)_needs))))))

$(foreach t,$(TARGETS),\
    $(foreach d,$(strip $(SUBDIRS) $(SUBDIRS_y)),$(eval $(t)::$(t)+$(d))))


endif # __subdirs_include
有人可以帮我弄清楚,如何解决这个问题的头文件:datapkt.h?如果需要任何其他细节,请告诉我。

由于 晴天

1 个答案:

答案 0 :(得分:-1)

错误消息来自您的编译器。它说文件modGPRS.c(在它所在的任何目录中,称之为 A )包含一个文件A/../inc/intModGPRS.h,它本身试图包含一个名为{的文件。 {1}},无法找到。这可能是因为你的makefile没有正确告诉编译器文件datapkt.h的位置,或者(更有可能)你没有安装必备库。

在尝试构建您正在尝试构建的任何内容之前,请确保已安装了所有需要安装的内容。至少告诉我你要安装的是什么,我无法帮助你。