View previous topic :: View next topic |
Author |
Message |
siegerstein
Joined: 17 Jan 2008 Posts: 8
|
Posted: Sat Jan 19, 2008 5:29 pm Post subject: Can't compile simple example |
|
|
test.d:
Code: |
import dbi.all;
import dbi.pg.all;
int main ( char [][] args ) {
PgDatabase db = new PgDatabase ( );
return 0;
}
|
$ gdc test.d -I/usr/include/d -fversion=Posix
test.d:10: Error: identifier 'PgDatabase' is not defined
test.d:10: Error: PgDatabase is used as a type
test.d:10: variable test.main.db voids have no value
test.d:10: Error: identifier 'PgDatabase' is not defined
test.d:10: Error: PgDatabase is used as a type
test.d:10: Error: new can only create structs, dynamic arrays or class objects, not void's
test.d:10: Error: cannot implicitly convert expression (new void) of type void* to int
gdc (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020))
DDBI: trunk r78
OS: GNU/Linux i686 |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Sun Jan 20, 2008 9:32 am Post subject: |
|
|
To not compile in support for databases you don't use, there is a version identifier for each. To use PgDatabase, set -fversion=dbi_pg . |
|
Back to top |
|
|
siegerstein
Joined: 17 Jan 2008 Posts: 8
|
Posted: Tue Jan 22, 2008 4:47 pm Post subject: Error: cannot create instance of abstract class PgDatabase |
|
|
Thanks. Work, but there is another error:
Code: | import dbi.all;
import dbi.pg.all;
int main ( char [][] args ) {
PgDatabase db = new PgDatabase ( );
return 0;
} |
$ gdc test.d -I/usr/include/d -I/usr/include/d/4.1.2 -fversion=Posix -fversion=dbi_pg
test.d:5: Error: cannot create instance of abstract class PgDatabase |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Tue Jan 22, 2008 6:07 pm Post subject: |
|
|
I have fixed that particular problem and your example compiles now on my machine, but I think you will find that the PgDatabase implementation in general is lacking. If you know libpq, your help would be appreciated. |
|
Back to top |
|
|
siegerstein
Joined: 17 Jan 2008 Posts: 8
|
Posted: Wed Jan 23, 2008 7:42 am Post subject: |
|
|
Quote: | If you know libpq, your help would be appreciated. |
Unfortunately I just beginner ... But I can catch bugs in UNIX-like OS :)
Quote: | I have fixed that particular problem and your example compiles now on my machine |
Yes, I can compiling it too, here is summary :)
Code: | gdc test.d -o test -I/usr/include/d -I/usr/include/d/4.1.2 -I/usr/include/d/4.1.2/i686-pc-linux-gnu -fversion=Posix -fversion=dbi_pg -ldbi -lpq -lgtango |
Thanks larsivi for help! |
|
Back to top |
|
|
|