User forums > Help

Sqlite installation into Code::Blocks

(1/4) > >>

geijt:
Does anyone know how to get SQLite 3.x working in Code::Blocks?

Everytime i try to use SQLite 3.x i receive the following error

--- Code: ---
.objs\main.o(.text+0x12e7):main.cpp: undefined reference to `sqlite3_open'
.objs\main.o(.text+0x12fb):main.cpp: undefined reference to `sqlite3_errmsg'
.objs\main.o(.text+0x1322):main.cpp: undefined reference to `sqlite3_close'
.objs\main.o(.text+0x135d):main.cpp: undefined reference to `sqlite3_get_table'
.objs\main.o(.text+0x1527):main.cpp: undefined reference to `sqlite3_free_table'
.objs\main.o(.text+0x1532):main.cpp: undefined reference to `sqlite3_close'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)

--- End code ---

rickg22:
I didn't know codeblocks was programmed to use SQLite... don't you mean a program of yours that uses sqlite?

Anyway did you link the libraries correctly? there should be a sqlite.a or something... (not sure what's it named tho).

geijt:
I mean a program i'm working on..

When i specify libsqlite3.a or libsqlite3 in the 'link libraries' with the path to that file in the 'linker directory' i receive the following error:


--- Code: ---
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)

--- End code ---


When i delete the path in 'linker directory' i see the following error:


--- Code: ---
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lsqlite3
collect2: ld returned 1 exit status

--- End code ---

Guillaume:
Hello,

I'm using this topic because I have exactly the same problem.

I would like to use SQLite library in a C::B project

Here is my source code :

--- Code: (cpp) ---#include <iostream>
#include "sqlite3.h"

typedef struct sqlite3 sqlite3;
sqlite3 *db;

using namespace std;
int main()
{
    int opening = sqlite3_open("tolkien_world.db", &db);
if (opening == 0) {
        cout << "Base ouverte avec succès" << endl;
} else {
cout << "Echec de l'ouverture de la base" << endl;
}
return 0;
}
--- End code ---

I have linked "tclsqlite3.dll" in my project (Build options > Linker options), but I have the same error message :
"ld.exe cannot find ltclsqlite3.dll"

If anyone can help me... I don't know what to do to solve this problem

Thank you ;)

killerbot:
you need to link with the import library not the dll itself

Navigation

[0] Message Index

[#] Next page

Go to full version