Compiler can't see a file that's in the project dir

I got some code online that uses the SQLite3 library in a small C++ console program and pasted it in a new Code::Blocks project. Then in the project tree (left side pane), I right clicked and added sqlite3.c and it immediately went into the source folder below main.cpp. So far so good.

I need to put in here that I'd already downloaded the sqlite3 amalgamation file and saved it to my /home dir on Linux Mint. I then copied sqlite3.c and sqlite3.h into the new project folder before I added the sqlite3.c file to the project.

So, when I tried to build/run it, it died instantly with this error:

/home/fmc/Desktop/CB/SQLite_Test-001/main.cpp:3:10: fatal error: sqlite3.h: No such file or directory

Here's a snippet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <stdio.h>
#include <sqlite3.h>using namespace std;
​
static int createDB(const char* s);
static int createTable(const char* s);
static int insertData(const char* s);
​
int main()
{
    const char* dir = "leaderboard.db";
        sqlite3* DB;
​
        createDB(dir);
        createTable(dir);
        insertData(dir);
​
        return 0;
}


And I'd shoot a pic in here of the folder contents, but it seems the board software doesn't allow such.

So what have I not done? Why can't the compiler see a file that's in the same folder as main.cpp?
Write your question here.

Last edited on
#include "" searches the current directory, then the search path (use the -I option).

#include <> searches the path.

You could try an explicit "-I."
Topic archived. No new replies allowed.