MongoDB在MFC下使用C++驱动编译错误的解决

时间:2014-06-20 17:08:50   收藏:0   阅读:273

今天使用MongoDB的C++驱动,在编译连接的时候一直出现错误,显示的string_data.h下93行max宏的问题,可视其本身并不是调用max宏,而是调用

std::numeric_limits<size_t>::max

这样就是产生错误,通过搜索发现解决方法(参考网址:http://blog.chinaunix.net/uid-17102734-id-2830143.html),将该函数用括号括起来,避免windows定义的混淆,具体修改如下

原始定义:

StringData substr( size_t pos, size_t n = std::numeric_limits<size_t>::max() ) const;

修改后定义:

StringData substr( size_t pos, size_t n = (std::numeric_limits<size_t>::max)() ) const;

注意添加的括号,这样就可以解决编译问题了

bubuko.com,布布扣
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。

MongoDB在MFC下使用C++驱动编译错误的解决,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!