天天看點

BDB c++例子,從源碼編譯到運作

第一步先下載下傳源碼,解壓後 ./dist/configure --enable-cxx編譯,然後make, make install

--enable-cxx

To build the Berkeley DB C++ API, enter --enable-cxx as an argument to configure.

預設的安裝路徑是:

/usr/local/BerkeleyDB.6.1/

代碼如下:

<a></a>

編譯:

 g++ -o cass cassandra_demo.cpp -I /usr/local/BerkeleyDB.6.1/include/ -L /usr/local/BerkeleyDB.6.1/lib/ -ldb_cxx-6.1

運作:

export LD_LIBRARY_PATH=/usr/local/BerkeleyDB.6.1/lib/

./cass

參考:

https://docs.oracle.com/cd/E17275_01/html/programmer_reference/build_unix_conf.html

https://cxwangyi.wordpress.com/2010/10/10/how-to-use-berkeley-db/

http://stackoverflow.com/questions/2628227/berkeley-db-cant-compile-c-codes

本文轉自張昺華-sky部落格園部落格,原文連結:http://www.cnblogs.com/bonelee/p/6524504.html,如需轉載請自行聯系原作者

繼續閱讀