digitalmars.D.learn - Compiling with SQLite
- impatient-dev (14/14) Nov 17 2014 I'm new to D, and I'm trying to use SQLite, but I can't get this
- impatient-dev (5/5) Nov 17 2014 Addendum: I'm using DDT for Eclipse, and the names I'm using come
- uri (4/19) Nov 17 2014 Are you linking with libsqlite3.a?
- impatient-dev (7/10) Nov 17 2014 That worked, thanks. I didn't know you had to anything special to
- tcak (5/14) Nov 18 2014 D doesn't have the whole implementation of SQLite. It is
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.
Nov 17 2014
Addendum: I'm using DDT for Eclipse, and the names I'm using come up in its autocomplete. They also appear at http://dlang.org/phobos/etc_c_sqlite3.html, which is why I'm stumped. I get what the error means, but I don't understand why it's occurring.
Nov 17 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
Nov 17 2014
On Tuesday, 18 November 2014 at 03:41:42 UTC, uri wrote:Are you linking with libsqlite3.a? For example: $ dmd prog.d -L-lsqlite3That worked, thanks. I didn't know you had to anything special to link with code in the standard library; is there documentation for this somewhere? Also, is there a way I could make SQLite work with DUB rather than building manually? The command-line help and web page don't seem to mention this anywhere.
Nov 17 2014
On Tuesday, 18 November 2014 at 05:06:59 UTC, impatient-dev wrote:On Tuesday, 18 November 2014 at 03:41:42 UTC, uri wrote:D doesn't have the whole implementation of SQLite. It is implemented as a library, and the sqlite3 module hooks up to library's functions. So, you should give your program the library ie. implementation of SQLite.Are you linking with libsqlite3.a? For example: $ dmd prog.d -L-lsqlite3That worked, thanks. I didn't know you had to anything special to link with code in the standard library; is there documentation for this somewhere?
Nov 18 2014









"impatient-dev" <impatient-dev example.com> 