- 浏览: 257798 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (263)
- mysql (5)
- boost (6)
- 工具 (10)
- IT生活 (7)
- 多线程 (3)
- Ruby (15)
- php (2)
- MongoDB (39)
- 移动互联网 (2)
- 测试 (8)
- c++ (28)
- 书 (1)
- 网站 (3)
- 网络编程 (14)
- 开源软件 (1)
- 分布式计算 (1)
- 得得得 (1)
- php,wordpress (1)
- error (5)
- 编译 (2)
- 学习 (1)
- 杀毒软件 (1)
- dd (0)
- linux (21)
- 数据库 (1)
- STL (1)
- c++/c (5)
- 软件设计 (1)
- 操作系统 (4)
- 库 (2)
- win32 (1)
- s (0)
- openssl (1)
- perl (2)
- debug (1)
- windows (4)
- python (12)
- windows 防火墙 (1)
- vs (1)
- vim (2)
- vc (1)
- 浏览器插件的危害 (1)
- curl (0)
- 判断手机号码合法性的库 (0)
- 地址备注 (0)
- 安装 File::Slurp (1)
- cenos (2)
- shell (1)
- linunx (1)
- internet (1)
- software (1)
- widows (1)
- linux io (1)
- nginx (2)
- 算法 (2)
- google (1)
- protobuf (2)
- tengine (1)
- tools (1)
- lua (2)
- liunx (1)
- vcard (1)
- lua-iconv (1)
- 网络 (2)
- teat (0)
- ldconfig linux (0)
- awk (0)
- grep (0)
- windws (2)
- linux 命令 (1)
- tcp dump (1)
- vmware (1)
- question2answer (2)
- mongdb (1)
- 正则 (1)
- OCR (2)
- Windows Server (1)
最新评论
利用mongodb c++ driver来编译 静态链接库,报错:
version.obj : error LNK2001: unresolved external symbol "void __cdecl boost::thr
ow_exception(class std::exception const &)" (?throw_exception@boost@@YAXABVexcep
tion@std@@@Z)
等
解决方法是修改SConstruct:
添加 env.AppendUnique(CXXFLAGS=Split("/EHsc"));
这个选项为编译动态链接库,应该去掉
以下为修改后的SConstruct,仅供参考
# scons file for MongoDB c++ client library and examples
import os
# options
AddOption( "--extrapath",
dest="extrapath",
type="string",
nargs=1,
action="store",
help="comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" )
AddOption( "--prefix",
dest="prefix",
type="string",
nargs=1,
action="store",
default="/usr/local",
help="installation root" )
AddOption( "--release", dest="release", type="string", nargs=0, action="store", help="release build" )
env = Environment( MSVS_ARCH=None )
debug = False
def has_option( name ):
x = GetOption( name )
if x is None:
return False
return True
release = has_option( "release" )
if release:
print("release")
debug = False
else:
print("debug")
debug = True
def addExtraLibs( s ):
for x in s.split(","):
if os.path.exists( x ):
env.Append( CPPPATH=[ x + "/include" ] )
env.Append( LIBPATH=[ x + "/lib" ] )
env.Append( LIBPATH=[ x + "/lib64" ] )
#add boost
boostDir = "E:/boost"
env.Append( CPPPATH=[ boostDir ] )
env.Append( LIBPATH=[ boostDir + "/lib" ] )
#add pcre
env.Append( CPPPATH=[ "./third_party/pcre-7.4" ] )
env.Append( LIBPATH=[ "./"] )
#set unicode
env.Append( CPPDEFINES=[ "_UNICODE" ] )
env.Append( CPPDEFINES=[ "UNICODE" ] )
#env.Append( CPPFLAGS="Ehsc" )
env.AppendUnique(CXXFLAGS=Split("/EHsc"));
if GetOption( "extrapath" ) is not None:
addExtraLibs( GetOption( "extrapath" ) )
env.Append( CPPPATH=[ "mongo/" ] )
env.Append( CPPDEFINES=[ "_SCONS" , "MONGO_EXPOSE_MACROS" ] )
nix = False
linux = False
if "darwin" == os.sys.platform:
addExtraLibs( "/opt/local/" )
nix = True
elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
nix = True
linux = True
if nix:
env.Append( CPPFLAGS=" -O3" )
env.Append( LIBS=["pthread"] )
if linux:
env.Append( LINKFLAGS=" -Wl,--as-needed -Wl,-zdefs " )
#add libs: thread, filesystem, program_options
boostLibs = [ "thread" , "filesystem", "program_options" ]
#for lib in boostLibs:
#env.Append( LIBS=[ "boost_%s-vc100-mt-1_48" % lib] )
#print("boost_%s-vc100-mt-1_48" % lib)
conf = Configure(env)
if debug:
env.Append( CPPDEFINES=[ "_DEBUG" ] )
env.Append( CPPFLAGS=" /MTd " )
for lib in boostLibs:
if not conf.CheckLib("boost_%s-vc100-mt-gd-1_48" % lib):
conf.CheckLib("boost_%s-mt-1_48" % lib)
else:
env.Append( CPPDEFINES=[ "NDEBUG" ] )
env.Append( CPPFLAGS=" /MT " )
for lib in boostLibs:
if not conf.CheckLib("boost_%s-vc100-mt-1_48" % lib):
conf.CheckLib("boost_%s-mt-1_48" % lib)
dirs = [ "" , "bson/" , "bson/util/" ,
"client/" , "s/" , "shell/" ,
"db/" ,
"scripting/" ,
"util/" , "util/concurrency/" , "util/mongoutils/" , "util/net/" ]
allClientFiles = []
for x in dirs:
allClientFiles += Glob( "mongo/" + x + "*.cpp" )
allClientFiles += Glob( "mongo/util/*.c" )
libs = []
#libs += env.SharedLibrary( "mongoclient" , allClientFiles )
libs += env.Library( "mongoclient" , allClientFiles )
# install
prefix = GetOption( "prefix" )
for x in libs:
env.Install( prefix + "/lib/" , str(x) )
for x in dirs:
x = "mongo/" + x
env.Install( prefix + "/include/" + x , Glob( x + "*.h" ) )
env.Alias( "install" , prefix )
# example setup
#clientTests = []
#clientEnv = env.Clone();
#clientEnv.Prepend( LIBS=["libmongoclient.a"])
#clientEnv.Prepend( LIBPATH=["."] )
# examples
#clientTests += [ clientEnv.Program( "firstExample" , [ "client/examples/first.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "secondExample" , [ "client/examples/second.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "whereExample" , [ "client/examples/whereExample.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "authTest" , [ "client/examples/authTest.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "httpClientTest" , [ "client/examples/httpClientTest.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "clientTest" , [ "client/examples/clientTest.cpp" ] ) ]
#clientEnv.Alias("clientTests", clientTests, [])
version.obj : error LNK2001: unresolved external symbol "void __cdecl boost::thr
ow_exception(class std::exception const &)" (?throw_exception@boost@@YAXABVexcep
tion@std@@@Z)
等
解决方法是修改SConstruct:
添加 env.AppendUnique(CXXFLAGS=Split("/EHsc"));
这个选项为编译动态链接库,应该去掉
以下为修改后的SConstruct,仅供参考
引用
# scons file for MongoDB c++ client library and examples
import os
# options
AddOption( "--extrapath",
dest="extrapath",
type="string",
nargs=1,
action="store",
help="comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" )
AddOption( "--prefix",
dest="prefix",
type="string",
nargs=1,
action="store",
default="/usr/local",
help="installation root" )
AddOption( "--release", dest="release", type="string", nargs=0, action="store", help="release build" )
env = Environment( MSVS_ARCH=None )
debug = False
def has_option( name ):
x = GetOption( name )
if x is None:
return False
return True
release = has_option( "release" )
if release:
print("release")
debug = False
else:
print("debug")
debug = True
def addExtraLibs( s ):
for x in s.split(","):
if os.path.exists( x ):
env.Append( CPPPATH=[ x + "/include" ] )
env.Append( LIBPATH=[ x + "/lib" ] )
env.Append( LIBPATH=[ x + "/lib64" ] )
#add boost
boostDir = "E:/boost"
env.Append( CPPPATH=[ boostDir ] )
env.Append( LIBPATH=[ boostDir + "/lib" ] )
#add pcre
env.Append( CPPPATH=[ "./third_party/pcre-7.4" ] )
env.Append( LIBPATH=[ "./"] )
#set unicode
env.Append( CPPDEFINES=[ "_UNICODE" ] )
env.Append( CPPDEFINES=[ "UNICODE" ] )
#env.Append( CPPFLAGS="Ehsc" )
env.AppendUnique(CXXFLAGS=Split("/EHsc"));
if GetOption( "extrapath" ) is not None:
addExtraLibs( GetOption( "extrapath" ) )
env.Append( CPPPATH=[ "mongo/" ] )
env.Append( CPPDEFINES=[ "_SCONS" , "MONGO_EXPOSE_MACROS" ] )
nix = False
linux = False
if "darwin" == os.sys.platform:
addExtraLibs( "/opt/local/" )
nix = True
elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
nix = True
linux = True
if nix:
env.Append( CPPFLAGS=" -O3" )
env.Append( LIBS=["pthread"] )
if linux:
env.Append( LINKFLAGS=" -Wl,--as-needed -Wl,-zdefs " )
#add libs: thread, filesystem, program_options
boostLibs = [ "thread" , "filesystem", "program_options" ]
#for lib in boostLibs:
#env.Append( LIBS=[ "boost_%s-vc100-mt-1_48" % lib] )
#print("boost_%s-vc100-mt-1_48" % lib)
conf = Configure(env)
if debug:
env.Append( CPPDEFINES=[ "_DEBUG" ] )
env.Append( CPPFLAGS=" /MTd " )
for lib in boostLibs:
if not conf.CheckLib("boost_%s-vc100-mt-gd-1_48" % lib):
conf.CheckLib("boost_%s-mt-1_48" % lib)
else:
env.Append( CPPDEFINES=[ "NDEBUG" ] )
env.Append( CPPFLAGS=" /MT " )
for lib in boostLibs:
if not conf.CheckLib("boost_%s-vc100-mt-1_48" % lib):
conf.CheckLib("boost_%s-mt-1_48" % lib)
dirs = [ "" , "bson/" , "bson/util/" ,
"client/" , "s/" , "shell/" ,
"db/" ,
"scripting/" ,
"util/" , "util/concurrency/" , "util/mongoutils/" , "util/net/" ]
allClientFiles = []
for x in dirs:
allClientFiles += Glob( "mongo/" + x + "*.cpp" )
allClientFiles += Glob( "mongo/util/*.c" )
libs = []
#libs += env.SharedLibrary( "mongoclient" , allClientFiles )
libs += env.Library( "mongoclient" , allClientFiles )
# install
prefix = GetOption( "prefix" )
for x in libs:
env.Install( prefix + "/lib/" , str(x) )
for x in dirs:
x = "mongo/" + x
env.Install( prefix + "/include/" + x , Glob( x + "*.h" ) )
env.Alias( "install" , prefix )
# example setup
#clientTests = []
#clientEnv = env.Clone();
#clientEnv.Prepend( LIBS=["libmongoclient.a"])
#clientEnv.Prepend( LIBPATH=["."] )
# examples
#clientTests += [ clientEnv.Program( "firstExample" , [ "client/examples/first.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "secondExample" , [ "client/examples/second.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "whereExample" , [ "client/examples/whereExample.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "authTest" , [ "client/examples/authTest.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "httpClientTest" , [ "client/examples/httpClientTest.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "clientTest" , [ "client/examples/clientTest.cpp" ] ) ]
#clientEnv.Alias("clientTests", clientTests, [])
发表评论
-
mongodb 从3.0 升级到3.2
2016-06-15 19:27 1399下载mongodb: curl "https://f ... -
MongoDB 日志切换
2016-06-13 17:47 774MongoDB默认情况下不会自动的切换轮转日志的,这将会导致日 ... -
mongodb c++ driver 从2.4.6 升级到3.0.1 注意点 (windows版本)
2015-09-15 17:58 6291. 使用mongodbclient的静态库需要定义下面的值 ... -
check_mongodb nagios
2015-08-17 17:22 0nagios check_mongodb插件监控mongodb ... -
Mongodb profiling
2015-08-06 10:14 360Mongodb profiling是Mngodb提供的类似于m ... -
linux mongdb 备份操作笔记
2015-07-22 09:21 526目的:添加一个延迟1小时的sencodary作为冷备数据库 ... -
mongodb 操作失失误救策略
2015-07-14 20:47 381杀掉某个正在处理的操作: db.currentOp() db ... -
mongodb oplog
2015-06-30 10:53 471mongodb oplog的使用 所在位置: Master/ ... -
mongodb 升级的问题导致添加帐号出现问题
2015-06-05 11:47 893mongodb 原有数据库版本:2.2.2 更新到数据库版本 ... -
libmongodbclient 2.6.6
2015-02-25 11:43 436mongodb c++ driver 2.6之后的版本不能从m ... -
mongodb 搜索结果保存到文件中
2013-07-22 16:44 1891第一种方式: mongo localhost:11111/te ... -
getLastError mongodb
2013-04-03 10:32 0一、简介 很多人抱怨mongodb是内存数据库,也没有事务,会 ... -
getLastError mongodb
2013-03-30 18:24 873http://docs.mongodb.org/manual/ ... -
[转]十个 MongoDB 使用要点
2013-03-20 10:19 779从 [url = "http://space.i ... -
利用mongodb c++ driver来编译
2012-12-04 15:12 0编译库时错误: 引用 E:\code_64\v2.2.2\m ... -
scons 64 mongodb
2012-08-01 19:52 938编译64位mongodb spin_lock.cpp cl ... -
scons 编译 mongodb client lib
2012-07-31 20:09 1170Use scons to build MongoDB and ... -
MongoDB 客户端 MongoVue
2012-05-14 11:13 911今天在同事那里看到了 ... -
mongodb 2.0.0 replica set + authentication bug
2012-04-26 13:56 891mongodb 2.0.0 replica set + aut ... -
array in mongodb ( c++ driver)
2012-04-25 17:31 2166BSONArray BSONArrayBuilder ...
相关推荐
windows 下 MongoDB C++ 64位驱动,debug库文件,目前最新MongoDB C++ Driver 3.4.x版。
MongoDB C++ Driver 3.4.x 版,是目前最新版本。需要和MongoDBC驱动一起使用。
MongoDB C++驱动编译教程,采用scons完成MongoDB C++驱动的编译,包括 boost库下载地址,MongoDB C++t驱动下载地址,包括Python 2.7.16版本 32位 X86安装包,以及驱动编译的具体教程,及编译过程中的几个示例。...
赠送jar包:mongodb-driver-core-4.2.3.jar; 赠送原API文档:mongodb-driver-core-4.2.3-javadoc.jar; 赠送源代码:mongodb-driver-core-4.2.3-sources.jar; 赠送Maven依赖信息文件:mongodb-driver-core-4.2.3....
mongodb c#驱动 最新驱动mongodb.driver.dll 版本2.12.0-beta1,包内有MongoDB.Bson.dll 、mongodb.driver.core.dll 等文件
赠送jar包:mongodb-driver-sync-4.2.3.jar; 赠送原API文档:mongodb-driver-sync-4.2.3-javadoc.jar; 赠送源代码:mongodb-driver-sync-4.2.3-sources.jar; 赠送Maven依赖信息文件:mongodb-driver-sync-4.2.3....
MongoDB Java Driver 简单操作
赠送jar包:mongodb-driver-sync-4.2.3.jar; 赠送原API文档:mongodb-driver-sync-4.2.3-javadoc.jar; 赠送源代码:mongodb-driver-sync-4.2.3-sources.jar; 赠送Maven依赖信息文件:mongodb-driver-sync-4.2.3....
java和mongodb连接,需要mongodb-driver,您还必须下载其依赖项: bson和 mongodb-driver-core》》3个包: mongodb-driver-3.8.2.jar; bson-3.8.2.jar; mongodb-driver-core-3.8.2.jar
mongodb-driver-core-3.5.0.jar,链接驱动
使用VS2017编译Mongodb数据库C++driver,编译结果在install文件夹中,另外还有写的word文档详细说明安装及编译过程,最后附加一个使用案例。
mongodb-driver-core-3.4.3,mongodb java开发常用组件。
MongoDB-C++-Driver3.2 动态库,含头文件,可直接连接使用,windows下动态链接库
mongoDB java driver api mongoDB java 驱动 所有类的api
mongodb-driver-3.4.3,mongodb java开发中常用组件。
mongodb2.6.12 windows编译32/64位开发库.
MongoDB针对C++驱动的安装
在win32系统下搭建MongoDb C++驱动 编译成dll文件
1. 设计并开发高效的C++对象池算法,时间复杂度为 O(1) 在整个重构框架中,对象池是负责管理内存的底层基本模块 2. 利用命令模式的思想开发 Redis 子模块 抽象出方便高效的接口提供给上层程序员使用 3. 利用组合...
赠送jar包:mongodb-driver-core-4.2.3.jar; 赠送原API文档:mongodb-driver-core-4.2.3-javadoc.jar; 赠送源代码:mongodb-driver-core-4.2.3-sources.jar; 赠送Maven依赖信息文件:mongodb-driver-core-4.2.3....