x264-snapshot-20091006-2245 vc2005编译成功

x264-snapshot-20091006-2245 是包含vc的最后一个版本了,所以我对这个版本进行了编译,开始一大把错误;然后逐步排查,一一解决;

(1)下载该版本 http://download.videolan.org/pub/videolan/x264/snapshots/

(2)首先编译libx264,错误如下

     2.1)主要是编译时,提示某个“;”分号之类的错误。

       这种错误就是因为变量未声明成功。由于是C代码,VC中,一般要求C代码的变量在函数开头声明。所以,如果变量是在函数中间声明,必然报错。解决方法就是,把这些报错的变量声明放到函数开头或者作用域(大括号)开头。

     解决这个问题后,出现一个错误:analyse.c(2950) : error C2059: syntax error : ‘[' ,错误的地方直接指向

static const uint8_t check_mv_lists[X264_MBTYPE_MAX] ={[P_L0]=1, [B_L0_L0]=1, [B_L1_L1]=2};
将它改为
static const uint8_t check_mv_lists[X264_MBTYPE_MAX] ={0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,0};

编译libx264成功;接着编译x264.exe

2.2)又出现2.1)中的错误,这个好解决,最好的办法就是将变量在函数开始时声明。

2.3)然后又出现一个bug:

muxers.c(299) : error C2146: syntax error :missing ‘)’ before identifier ‘PRIx32′

fprintf( stderr, “Bad header magic (%”PRIx32″ <=> %s)\n”, *((uint32_t*)header), header );

改为

fprintf( stderr, “Bad header magic (%ld <=>%s)\n”, *((uint32_t*)header), header );

继续编译:x264 出现如下bug:

1>libx264.lib(encoder.obj) : error LNK2019: unresolved
external symbol _x264_lookahead_is_empty referenced in function
_x264_encoder_encode

1>libx264.lib(encoder.obj) : error LNK2019: unresolved
external symbol _x264_lookahead_get_frames referenced in function
_x264_encoder_encode

1>libx264.lib(encoder.obj) : error LNK2019: unresolved
external symbol _x264_lookahead_put_frame referenced in function
_x264_encoder_encode

1>libx264.lib(encoder.obj) : error LNK2019: unresolved
external symbol _x264_lookahead_delete referenced in function
_x264_encoder_close

1>libx264.lib(analyse.obj) : error LNK2019: unresolved
external symbol _log2f referenced in function _x264_analyse_init_costs

1>bin/x264.exe : fatal error LNK1120: 6 unresolved
externals

         这是因为:libx264工程没有添加lookahead.c文件,从而缺少几个函数的定义造成的,添加lookahead.c进工程;

再次Build libx264工程,修改以下几个错误

  • 1>..\..\encoder\lookahead.c(135) : error C2143: syntax
    error : missing ‘;’ before ‘type’
  • 1>..\..\encoder\lookahead.c(154) : error C2275: ‘x264_t’ :
    illegal use of this type as an expression
  • 1>..\..\encoder\lookahead.c(259) : error C2143: syntax error
    : missing ‘;’ before ‘type’

然后接续编译:

  • 1>libx264.lib(analyse.obj) : error LNK2019: unresolved external symbol _log2f referenced in function _x264_analyse_init_costs

这是因为没有定义log2f函数,添加

#definelog2f(x) (logf(x)*1.4426950408889634f)

到osdep.h中,再次编译x264 成功;

在这个过程中,我参考了:

http://lsharemy.com/wordpress/index.php/csit/build-x264-with-phread-support/

http://zhanyonhu.blog.163.com/blog/static/1618604420105228545157/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值