I am trying to use sqlite3 in a C ++ project in Eclipse and have found a lot of advice on the Internet for using the API, but unfortunately I am attacking an earlier hurdle. I assume this is due to a lack of experience with C / C ++ and CDT. I just copied sqlite3.c and sqlite3.h to the project's source folder and got a test method that looks like this:
int main() { sqlite3* db; sqlite3** dbpointer = &db; const char* dbname = "test.db"; sqlite3_open(dbname, dbpointer); return 0; }
However, the sqlite3.c file appears in Eclipse with numerous errors. For example, the next section annotates "Field" IN_DECLARE_VTAB "cannot be resolved."
#ifdef SQLITE_OMIT_VIRTUALTABLE #define IN_DECLARE_VTAB 0 #else #define IN_DECLARE_VTAB (pParse->declareVtab) #endif
When I try to compile, I get a series of errors like:
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/sqlite3.d" -MT"src/sqlite3.d" -o "src/sqlite3.o" "../src/sqlite3.c" ../src/sqlite3.c:30997: error: initializer element is not constant ../src/sqlite3.c:30997: error: (near initialization for `aSyscall[0].pCurrent') ../src/sqlite3.c:30997: error: initializer element is not constant ../src/sqlite3.c:30997: error: (near initialization for `aSyscall[0]') ../src/sqlite3.c:31009: error: initializer element is not constant ../src/sqlite3.c:31009: error: (near initialization for `aSyscall[1]') ../src/sqlite3.c:31017: error: initializer element is not constant ../src/sqlite3.c:31017: error: (near initialization for `aSyscall[2]')
I found a similar question here , but it did not seem to be resolved either.
I suspect this is a problem with configuring Eclipse, so if anyone could give me any tips or directions on useful tutorials, I would really appreciate it. And if I would be better off posting this on a special sqlite forum, just let me know.
source share