boost 1.57在VC2012里编译出错以及解决
最新发布的boost版本是在2014年11月3日发布,由于项目里使用,就立即更新为最新版本的库,这样也可以让可能出现的BUG减到最少。
不过在更新这库之后,发现原来可以编译通过的项目,而现在不能通过了,提示错误如下:
transform_width.hpp(156): error C2589: '(' : illegal token on right side of '::'
通过仔细地查看transform_width.hpp文件,发现是其中的std::min使用有问题,因为min函数的两个传入参数类型不一样,这样进行模板
匹配时,就找不到相应的模板。这行代码如下:
unsigned int i = std::min(missing_bits, m_remaining_bits);
通过函数的代码来分析,missing_bits是unsigned int类型,而m_remaining_bits是CHAR类型,导致编译出错。知道了出错的原因,就容易
解决了。把这行代码修改为:
unsigned int i = std::min<unsigned int>(missing_bits, m_remaining_bits);
相关的模板代码:
template<
class Base,
int BitsOut,
int BitsIn,
class CharType
>
void transform_width<Base, BitsOut, BitsIn, CharType>::fill() {
unsigned int missing_bits = BitsOut;
m_buffer_out = 0;
do{
if(0 == m_remaining_bits){
if(m_end_of_sequence){
m_buffer_in = 0;
m_remaining_bits = missing_bits;
}
else{
m_buffer_in = * this->base_reference()++;
m_remaining_bits = BitsIn;
}
}
// append these bits to the next output
// up to the size of the output
修改之前:
unsigned int i = std::min(missing_bits, m_remaining_bits);
把这行修改为:
unsigned int i = std::min<unsigned int>(missing_bits, m_remaining_bits);
// shift interesting bits to least significant position
base_value_type j = m_buffer_in >> (m_remaining_bits - i);
// and mask off the un interesting higher bits
// note presumption of twos complement notation
j &= (1 << i) - 1;
// append then interesting bits to the output value
m_buffer_out <<= i;
m_buffer_out |= j;
// and update counters
missing_bits -= i;
m_remaining_bits -= i;
}while(0 < missing_bits);
m_buffer_out_full = true;
}
蔡军生 QQ: 9073204 深圳
boost 1.57在VC2012里编译出错以及解决相关推荐
- 有线网卡linux驱动,Ubuntu 12.04下QCA8172有线网卡驱动编译出错的解决方法
基于以前的笔记本配置太低,无法满足科研需求,本人屁颠屁颠的去买了一个还算配置蛮新的电脑. 因为科研要在Linux环境下,本人安装了Ubuntu 12.04+WIN7双系统.但是问题出来了,在Ubunt ...
- Linux微信运行错误,Ubuntu 16.04 运行微信开发者工具编译出错的解决办法
最近有折腾小程序的意向,但微信的开发者工具只提供了 Windows 和 Mac 两个版本,对于我这样的 Linux 用户来说不是那么地友好. 经过观察发现,那个开发者工具实际上是基于nw.js开发的, ...
- 静态编译出错的解决办法 undefined reference to `clock_gett...
2019独角兽企业重金招聘Python工程师标准>>> gcc -Wall -g -O2 -I/usr/local/include -m64 -o magent magent.o k ...
- QML新建QML后编译出错的解决方法
解决方法: 原有工程可以编译通过,添加了新的qml文件后,编译出现以下错误: undefined reference to QmlCacheGeneratedCode XXX 重新构建工程,错误仍未解 ...
- [ExtJS 6] SenchaCmd编译出错与解决
错误描述 D:\inssoftware\Sencha\Cmd\6.6.0.13\plugin.xml:333: The following error occurred while executing ...
- 由一次奇怪的编译出错想起的
现象 最近在工作中遇到了一次奇怪的编译出错.事情是这样的,本来这个asp.net webform应用是可以编译的.但是将另外一个class library的工程加入到这个asp.net webform ...
- 20220319编译OpenHarmony-v3.1-beta出错的解决方法
20220319编译OpenHarmony-v3.1-beta出错的解决方法 2022/3/19 14:29 [结论]:华为的做事也太不认真了!^_你的压缩包都没有给完整的,还好我做过的! (程序文本 ...
- 关于“ROS2 Topic-Statistics-Tutorial编译出错”的思考2
关于"ROS2 Topic-Statistics-Tutorial编译出错"的思考 复现了一下其中报错信息: 如果选foxy会有如上错误,如果选galactic则不会报错,顺利编译 ...
- macOS+matlab 2020b matlab_bgl工具箱使用时 MEX文件编译出错
引言 对于matlab_bgl工具箱来说,要在64 位 mac 上使用最新版本的 Matlab 进行编译时,需要使用者手动进行一些配置,在成功配置之后,决定将一系列过程整理成文,供大家参考. 解决&q ...
最新文章
- tomcat日志切割
- 习题1.9 有序数组的插入 (20 分)
- Genymotion模拟器
- 零基础的跨界自学拿到腾讯Offer的学习资料
- restify mysql_[菜鸟试水]关于Nodejs搭建后台API服务(Mysql-Restify)[下]
- webpack对脚本和样式的处理
- Apache+Tomcat动静分离
- 设计模式的七大设计原则:其六:迪米特法则
- (花生壳)向日葵 相关虚拟硬件(驱动)造成 xp 系统无法正常 待机、休眠
- .NET 4.0 使用 asyn await
- 如何下载乌龟svn中文版
- Chrome 安装有道画词取义插件
- Python爬虫爬取淘宝天猫,处理url正确的解码方法
- Stata:各类全要素生产率TFP估算方法
- 【机器学习】十大机器学习基础算法
- js怎么实现hmacsha256_各种语言HMAC SHA256实现
- 为什么 SD-WAN 很重要?
- 第六十八章 Caché 函数大全 $WASCII 函数
- VCS编译仿真警告Warning
- 华为云灾备方案,如何保障企业数据安全