致命错误:sqlite3.h:没有那个文件或目录 [英] fatal error: sqlite3.h: No such file or directory

查看:142
本文介绍了致命错误:sqlite3.h:没有那个文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过对 Zynq 板(ARM 架构)进行交叉编译来构建 C 应用程序.当我在没有提及 ARM arch 的情况下输入 make 时,它​​在我的笔记本电脑上运行良好.但是一旦我修改了 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 文件的位置实际上在你的文件系统上.但是,根据您所做的显示,我怀疑您需要将 INCLUDES 变量更改为:

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 更改为 #include "sqlite/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 标志放在 INCLUDES 变量中:

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 是复数,这可能会让某人相信他们可以在该变量中添加多个目录,但是如果您保持原样,这将导致奇怪的编译器错误:

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 another/dir... 注意第二个目录如何没有 -I 选项.

will add the flags -Ilib/sqlite another/dir... note how the second directory doesn't have a -I option.

当然,按照惯例,您应该使用 CPPFLAGS(用于 C 预处理器标志),而不是 INCLUDES,而是... :)

Of course, by convention you should be using CPPFLAGS (for C preprocessor flags), not INCLUDES, but... :)

这篇关于致命错误:sqlite3.h:没有那个文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆