致命错误:sqlite3.h:没有这样的文件或目录 [英] fatal error: sqlite3.h: No such file or directory
问题描述
我想通过建立交叉编译的ZYNQ板(ARM架构)C应用程序。当我键入make不提ARM拱,它工作正常,我的笔记本电脑。但只要我修改Makefile,我得到一个错误说:
I'm trying to build a C application through cross compiling for a Zynq board (ARM architecture). When I type make without mentioning the ARM arch, it works fine on my laptop. But as soon as I modify the Makefile, I get an error saying:
main.c:20:43: fatal error: sqlite3.h: No such file or directory
#include "sqlite3.h" //library for sqlite3
^
compilation terminated.
make: *** [ws_temp_server] Error 1
在Makefile文件看起来是这样的:
The Makefile looks like this:
SOURCE=lib/base64_enc.c lib/websocket.c lib/sha1.c lib/sqlite/sqlite3.c main.c
CC = arm-xilinx-linux-gnueabi-gcc
LDFLAGS=-lpthread -ldl
INCLUDES=lib/
PROGRAM=ws_temp_server
all: $(PROGRAM)
$(PROGRAM): $(SOURCE)
$(CC) $(SOURCE) -I$(INCLUDES) -o$(PROGRAM) $(LDFLAGS)
clean:
rm $(PROGRAM)
我是什么做错了吗?感谢您的帮助,我可以得到的。
What am I doing wrong? Thanks for any help I can get.
推荐答案
您没有提供足够的信息肯定地说:特别是,你不说,其中 sqlite3.h
文件实际上是在你的文件系统。然而,根据你展示一下我怀疑你需要改变包含
变量,这样:
You don't provide enough information to say for sure: in particular, you don't say where the sqlite3.h
file actually is on your filesystem. However, based on what you do show I suspect you need to change the INCLUDES
variable, to this:
INCLUDES = lib/sqlite
(或者修改的#include
在code为的#include源码/ sqlite3.h
)。这是假设的头文件在同一目录 sqlite3.c
源文件。
(or else change the #include
in your code to be #include "sqlite/sqlite3.h"
). This is assuming that the header file is in the same directory as the sqlite3.c
source file.
请注意,这是一个坏/混淆的实现。你应该把 -I
标记中的包含
变量:
Note that this is a bad/confusing implementation. You should be putting the -I
flag in the INCLUDES
variable:
INCLUDES = -Ilib/sqlite
...
$(PROGRAM): $(SOURCE)
$(CC) $(SOURCE) $(INCLUDES) -o$(PROGRAM) $(LDFLAGS)
包含
是复数,这可能导致有人相信他们能够在该变量添加多个目录,但如果你离开它,你有它的方式,这将导致奇怪的编译器错误:
INCLUDES
is plural which may lead someone to believe they could add multiple directories in that variable, but if you leave it the way you have it, this will cause strange compiler errors:
INCLUDES = lib/sqlite another/dir
...
$(PROGRAM): $(SOURCE)
$(CC) $(SOURCE) -I$(INCLUDES) -o$(PROGRAM) $(LDFLAGS)
将新增标志 -Ilib / SQLite的另一个/ DIR
...注意如何在第二目录不具有 -I
选项。
will add the flags -Ilib/sqlite another/dir
... note how the second directory doesn't have a -I
option.
当然,按照惯例,你应该使用 CPPFLAGS
(对于C preprocessor标志),而不是包含
,但是...:)
Of course, by convention you should be using CPPFLAGS
(for C preprocessor flags), not INCLUDES
, but... :)
这篇关于致命错误:sqlite3.h:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!