Makfile,求指点:编写makefile来编译文件时,指定了头文件路径,但是报库函数的东西未声明,咋回事?
说明:所有的cpp和h文件在一个jni目录下。如果不指定头文件目录能够编过,指定了就报系统库文件的变量未声明makfile:CC=arm-linux-g++CFLAGS=...
说明:所有的cpp和h文件在一个jni目录下。如果不指定头文件目录能够编过,指定了就报系统库文件的变量未声明
makfile:
CC = arm-linux-g++
CFLAGS = -Wall -g -O3
File_Path := /opt/cy/product/cps/e_life_wise_c/elife_mon
LIB_OBJECT := e_life_sdk.a
LOCAL_SRC_FILES:=json_reader.cpp json_value.cpp json_writer.cpp elife_common.cpp elife_mon.cpp
OBJS := $(patsubst %.cpp,%.o,$(LOCAL_SRC_FILES))
$(OBJS): $(LOCAL_SRC_FILES)
$(CC) -c $< -o $@ -I $(File_Path)/jni
clean:
rm -f *.o
错误:
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:795: error: variable or field 'clearerr' declared void
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:795: error: 'FILE' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:795: error: '__stream' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:797: error: 'FILE' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:797: error: '__stream' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:799: error: 'FILE' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:799: error: '__stream' was not declared in this scope
解释:
虽然不指定头文件目录能够编过,但是指定就编不过。为啥我要较真这个呢,是因为我还有编一个工程,cpp和h不在一个目录,那么就必须要指定头文件的目录,也报上面的错。补充:除了库函数,所有的声明都在h文件的目录下。
求大神指点!! 展开
makfile:
CC = arm-linux-g++
CFLAGS = -Wall -g -O3
File_Path := /opt/cy/product/cps/e_life_wise_c/elife_mon
LIB_OBJECT := e_life_sdk.a
LOCAL_SRC_FILES:=json_reader.cpp json_value.cpp json_writer.cpp elife_common.cpp elife_mon.cpp
OBJS := $(patsubst %.cpp,%.o,$(LOCAL_SRC_FILES))
$(OBJS): $(LOCAL_SRC_FILES)
$(CC) -c $< -o $@ -I $(File_Path)/jni
clean:
rm -f *.o
错误:
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:795: error: variable or field 'clearerr' declared void
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:795: error: 'FILE' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:795: error: '__stream' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:797: error: 'FILE' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:797: error: '__stream' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:799: error: 'FILE' was not declared in this scope
/opt/cy/product/cps/arm-eabi-env/opt/FriendlyARM/toolschain/4.4.3/bin/../arm-none-linux-gnueabi//sys-root/usr/include/stdio.h:799: error: '__stream' was not declared in this scope
解释:
虽然不指定头文件目录能够编过,但是指定就编不过。为啥我要较真这个呢,是因为我还有编一个工程,cpp和h不在一个目录,那么就必须要指定头文件的目录,也报上面的错。补充:除了库函数,所有的声明都在h文件的目录下。
求大神指点!! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询