1
I am creating a software in C that uses Sqlite 3 as database, however, when compiling the project Codeblocks returns me the following error message:
createdata. c|| undefined reference to 'sqlite3_open'|
undefined reference to 'sqlite3_errmsg'|
How to fix this error?
My code:
int CriarBanco()
{
sqlite3 *banco;
char *MsgErro = 0;
int rc;
char *sql;
/**Abrir banco de dados**/
rc = sqlite3_open("produto.db", &banco);
if(rc)
{
fprintf(stderr, "Nao foi possivel abrir o banco de dados.", sqlite3_errmsg(banco));
exit(0);
}
else
fprintf(stdout, "Banco aberto com sucesso.");
return 0;
}
PS: I am using this library <sqlite3.h>
and I’m compiling with GCC.
Windows, Linux or Mac? How did you install Sqlite on them?
– Leonardo Costa
Linux Ubuntu already installed yes.
– gato