且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

致命错误:sqlite3.h:没有这样的文件或目录

更新时间:2021-10-13 21:33:53

您没有提供足够的信息肯定地说:特别是,你不说,其中 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... :)