FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't compile simple example

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
siegerstein



Joined: 17 Jan 2008
Posts: 8

PostPosted: Sat Jan 19, 2008 5:29 pm    Post subject: Can't compile simple example Reply with quote

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
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Sun Jan 20, 2008 9:32 am    Post subject: Reply with quote

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
View user's profile Send private message
siegerstein



Joined: 17 Jan 2008
Posts: 8

PostPosted: Tue Jan 22, 2008 4:47 pm    Post subject: Error: cannot create instance of abstract class PgDatabase Reply with quote

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
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Tue Jan 22, 2008 6:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
siegerstein



Joined: 17 Jan 2008
Posts: 8

PostPosted: Wed Jan 23, 2008 7:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group