我运行了从网站 http://h264bitstream.sourceforge.net/ 下载的 h264 解析器程序
当我运行代码时出现以下错误
error C2668: 'log' : ambiguous call to overloaded function
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(575): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(527): or 'float log(float)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(120): or 'double log(double)'
在下面的代码中
else if( pps->slice_group_map_type == 6 )
{
pps->pic_size_in_map_units_minus1 = bs_read_ue(b);
for( i = 0; i <= pps->pic_size_in_map_units_minus1; i++ )
{
**pps->slice_group_id[ i ] = bs_read_u(b, ceil( log2( pps->num_slice_groups_minus1 + 1 ) ) ); // was u(v)**
}
}
}
error C2668: 'log' : ambiguous call to overloaded function 1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(575): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(527): or 'float log(float)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(120): or 'double log(double)'
1> while trying to match the argument list '(int)' in the following piece of code
if( pps->num_slice_groups_minus1 > 0 &&
pps->slice_group_map_type >= 3 && pps->slice_group_map_type <= 5)
{
sh->slice_group_change_cycle =
**bs_read_u(b, ceil( log2( pps->pic_size_in_map_units_minus1 +
pps->slice_group_change_rate_minus1 + 1 ) ) ); // was u(v) // FIXME add 2?**
}
error C2668: 'log' : ambiguous call to overloaded function 1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(575): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(527): or 'float log(float)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(120): or 'double log(double)'
1> while trying to match the argument list '(int)'
bs_write_ue(b, pps->pic_size_in_map_units_minus1);
for( i = 0; i <= pps->pic_size_in_map_units_minus1; i++ )
{
**bs_write_u(b, ceil( log2( pps->num_slice_groups_minus1 + 1 ) ), pps->slice_group_id[ i ] ); // was u(v)**
}
}
我应该怎么做才能解决?
最佳答案
将您对 log2 的调用修改为如下所示:
log2( (double)(pps->num_slice_groups_minus1 + 1) )
关于c++ - 错误 C2668 对来自站点 http ://h264bitstream. sourceforge.net/的重载函数代码的模糊调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10013434/