c++databasesqlitec++builder-5

Errors with compiling sqlite database with c++ builder 5


I'm having trouble trying to compile sqlite database with C++Builder 5 code.

I downloaded sqlite-amalgamation, and added all the files to the project:

shell.c
sqlite3.c
sqlite3.h
sqlite3ext.h

Then I included sqlite3.h in the MainForm where the database will be used.

First I thought it was my code which had problems, but after testing it with a simple Form with a DBGrid to show data inside the database, I get these errors:

[C++ Warning] shell.c(205): W8065 Call to function '_setmode' with no                           prototype
[C++ Warning] shell.c(209): W8065 Call to function '_setmode' with no prototype 
[C++ Error] shell.c(1420): E2257 , expected
[C++ Error] shell.c(1432): E2141 Declaration syntax error
[C++ Error] shell.c(1432): E2139 Declaration missing ;
[C++ Warning] shell.c(1432): W8004 'RC' is assigned a value that is never used
[C++ Error] shell.c(1432): E2190 Unexpected }
[C++ Error] shell.c(1460): E2040 Declaration terminated incorrectly
[C++ Error] shell.c(1460): E2141 Declaration syntax error
[C++ Error] shell.c(1460): E2141 Declaration syntax error
[C++ Error] shell.c(1729): E2190 Unexpected }
[C++ Error] shell.c(1729): E2190 Unexpected }
[C++ Warning] shell.c(2382): W8053 '_chmod(const signed char *,int,...)' is obsolete
[C++ Warning] shell.c(2504): W8065 Call to function 'S_ISLNK' with no prototype
[C++ Warning] shell.c(2529): W8065 Call to function 'S_ISLNK' with no prototype
[C++ Error] shell.c(2558): E2139 Declaration missing ;
[C++ Error] shell.c(2638): E2451 Undefined symbol 'pDir'
[C++ Error] shell.c(2638): E2451 Undefined symbol 'pDir'
[C++ Warning] shell.c(2638): W8065 Call to function 'closedir' with no prototype
[C++ Error] shell.c(2701): E2451 Undefined symbol 'pDir'
[C++ Warning] shell.c(2701): W8065 Call to function 'opendir' with no prototype
[C++ Error] shell.c(2702): E2451 Undefined symbol 'pDir'
[C++ Error] shell.c(2710): E2451 Undefined symbol 'pDir'
[C++ Warning] shell.c(2710): W8065 Call to function 'readdir' with no prototype
[C++ Warning] shell.c(2710): W8069 Nonportable pointer conversion
[C++ Error] shell.c(2712): E2451 Undefined symbol 'd_name'
[C++ Error] shell.c(2713): E2451 Undefined symbol 'd_name'
[C++ Error] shell.c(2713): E2451 Undefined symbol 'd_name'
[C++ Error] shell.c(2714): E2451 Undefined symbol 'd_name'
[C++ Error] shell.c(2717): E2451 Undefined symbol 'd_name'
[C++ Error] shell.c(2725): E2451 Undefined symbol 'pDir'
[C++ Warning] shell.c(2725): W8065 Call to function 'closedir' with no prototype
[C++ Error] shell.c(2727): E2451 Undefined symbol 'pDir'
[C++ Warning] shell.c(8794): W8072 Suspicious pointer arithmetic
[C++ Warning] shell.c(15699): W8065 Call to function '_isatty' with no prototype
[C++ Warning] shell.c(15700): W8065 Call to function '_isatty' with no prototype

What is the problem?

I followed Internet tutorials on how to add sqlite, but they don't work.

If it's not possible to use sqlite with C++Builder 5, is there another embedded database that is compatible with it?

I heard I can use a CSV file as a database, can I do that? If so, how?


Solution

  • The file shell.c is for the command-line shell; you do not need it to access databases from your code.

    The only files you need are sqlite3.c and sqlite3.h, and only the former actually needs to be compiled.