Compiling with SQLite

uri via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 17 19:41:41 PST 2014


On Tuesday, 18 November 2014 at 01:14:26 UTC, impatient-dev wrote:
> I'm new to D, and I'm trying to use SQLite, but I can't get 
> this basic program to compile:
>
> import etc.c.sqlite3 : sqlite3_open;
>
> void main(string[] args){
> 	sqlite3_open("test.sqlite", null);
> }
>
> When compiling with DMD v2.066.1, I get this error:
>
> test.o: In function `_Dmain':
> test.d:(.text._Dmain+0x2f): undefined reference to 
> `sqlite3_open'
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
> Any idea what I'm doing wrong? I'm on Ubuntu 12.04 64-bit, but 
> I doubt that matters. I've tried a couple alternatives, but 
> they didn't work either.


Are you linking with libsqlite3.a?

For example:

$ dmd prog.d -L-lsqlite3




More information about the Digitalmars-d-learn mailing list