dbTalk Databases Forums  

Can't use the installed libraries.

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Can't use the installed libraries. in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Amber
 
Posts: n/a

Default Can't use the installed libraries. - 03-01-2006 , 03:00 AM






I downloaded berkeley-db 4.4.20 windows ims installed file,installed it
on my windows 2003 server os.
In visual studio .net 2003 I created a test mfc project to use the DB
library.
add include directory :\Program Files\Sleepycat Software\Berkeley DB
4.4.20\include
add lib directory :\Program Files\Sleepycat Software\Berkeley DB
4.4.20\lib
add lib dependency:libdb44.lib
add D:\Program Files\Sleepycat Software\Berkeley DB 4.4.20\bin to PATH
environment variable.

In the test project I write code like this
Db db(NULL,0);
u_int32_t oFlags = DB_CREATE;

try
{
db.open(NULL,
"my_db.db",
NULL,
DB_BTREE,
oFlags,
0);
db.close(0);

}
catch(DbException &dbe)
{

}
catch(std::exception &e)
{
}
The test project works well, and a my_db.db file was created.
But when I do the same in Visual Studio 2005 ,the test project even
can't get complied,throw error like this:
1>d:\program files\sleepycat software\berkeley db
4.4.20\db-4.4.20\build_win32\db.h(1206) : error C2143: syntax error :
missing '}' before '('
double click the error ,visual studio points to db.h at:

typedef enum {
DB_BTREE=1,
DB_HASH=2,
DB_RECNO=3,
DB_QUEUE=4,
DB_UNKNOWN=5 /* Figure it out on open. */
} DBTYPE;
And when I use Visual studio .net 2005 to build from source ,It can't
work according to the build manual.
Anybody knows why?


Reply With Quote
  #2  
Old   
Amber
 
Posts: n/a

Default Re: Can't use the installed libraries. - 03-01-2006 , 03:03 AM






I am sorry ,it's the .msi install file


Reply With Quote
  #3  
Old   
Ron
 
Posts: n/a

Default Re: Can't use the installed libraries. - 03-01-2006 , 03:33 PM



Hi,

This issue was also cross posted to the SR system and is currently
being responded to there.

Ron


Reply With Quote
  #4  
Old   
ron.cohen@gmail.com
 
Posts: n/a

Default Re: Can't use the installed libraries. - 03-03-2006 , 03:10 PM



The following FAQ entry described this issue in more detail and a
workaround.

http://dev.sleepycat.com/resources/f...ction%3Dsearch

Ron


Reply With Quote
  #5  
Old   
Amber
 
Posts: n/a

Default Re: Can't use the installed libraries. - 03-04-2006 , 03:03 AM



Can anybody explain the SleepCat workaround for me ?
Q. Why do I get a compilation error in Visual Studio when I create a
project using MFC or anything that includes OleDb.h?
A. There is a conflict with Berkeley DB's use of enumerated DBTYPE and
the typedef DBTYPE defined in OleDB.h an include file for the Microsoft
SDK.
One workaround is to use our header file as follows:



Quote:
/* Work around DBTYPE name conflict with Microsoft's oledb.h */
#define DBTYPE BDB_DBTYPE
#include
#undef DBTYPE

Quote:
Then if you need to use our DBTYPE, refer to it as BDB_DBTYPE. The same thing works if you are including db_cxx.h.
Another possibility is to structure your application so that our header file and Microsoft's oledb.h are not mixed in the same source >file.
If I want include <db_cxx.h> in my TestDialog.cpp ,I should wirte :

#define DBTYPE BDB_DBTYPE
#include <db_cxx.h>
#undef DBTYPE

in TestDialog.cpp ? And why this works?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.