C++实现的BOSN bson-cpp的编译
flyfish 2015-7-24
编译环境:
VC2010 64位
需要配置Boost库
这里的Boost配置是
Boost库的目录在E:\LIB\boost64
它的下级内容是
配置属性-》C/C++-》常规-》附加包含目录
E:\LIB\boost64
链接器-》常规-》附加库目录 或者 库管理器-》附加库目录
E:\LIB\boost64\stage\lib
在bsonspec.org中有一个C++实现的BSON github.com/jbetnet/bson-cpp
A standalone C++ BSON implementation forked from the MongoDB C++ driver, with the non-BSON code pruned away.
一个独立的,从MongoDB C++驱动分叉的C++ BSON实现,删除了与BSON无关的代码。
github下载地址
https://github.com/jbenet/bson-cpp
错误1
TIME_UTC”: 不是“boost”的成员
C++ 11定义了TIME_UTC这个宏,为了避免冲突,Boost将TIME_UTC修改为TIME_UTC_
错误2
“sleep”: 不是“boost”的成员
“thread”:“::”左侧的符号必须是一种类型
void sleep(system_time const& abs_time);
查1.58.0版boost文档对sleep的解析
[Warning] Warning
DEPRECATED since 3.0.0.
Use this_thread::sleep_for() or this_thread::sleep_until().
警告:
该函数已被启用 使用this_thread::sleep_for()或者this_thread::sleep_until()
sleep_until()
Effects:
Suspends the current thread until the time point specified by abs_time has been reached.
作用:
挂起当前线程直到指定的abs_time时间点到来
sleep_for()
Effects:
作用:
Suspends the current thread until the duration specified by by rel_time has elapsed.
挂起当前线程直到指定持续时间rel_time
一个是time point时间点,一个是duration持续的时间
这里使用boost::this_thread::sleep_for
将boost::thread::sleep(xt);
boost::this_thread::sleep_for(boost::chrono::seconds(xt.sec));
编译成功的源码下载地址
下载地址
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/177621.html原文链接:https://javaforall.net
