VS2008下最新X264(svn 2009.9)编译不过的解决办法
生活随笔
收集整理的這篇文章主要介紹了
VS2008下最新X264(svn 2009.9)编译不过的解决办法
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
總有人說(shuō)最新的版本
編譯不過(guò),搞的群、
論壇里到處都是這種求助貼。建議斑竹把這個(gè)解決辦法放到醒目的位置,以減少噪音。
科普開始
1、編譯問(wèn)題
由于MS的VS編譯器對(duì)C99標(biāo)準(zhǔn)支持不好,不支持函數(shù)當(dāng)中混合定義、聲明變量。
解決辦法:在函數(shù)開頭統(tǒng)一定義變量
e.g
編譯不過(guò)
void funA() { ?? ?? ?? ?? ?? ?? ?? ?? ?? void funA() {
int i,j; ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? int i,j,x;
i = 0; ?? ?? ?? ========> ?? ?? i = 0;
int x = 0; ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??? x = 0;
} ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??? }
2、鏈接問(wèn)題
libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_init,該符號(hào)在函數(shù) _x264_encoder_open_75 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_is_empty,該符號(hào)在函數(shù) _x264_encoder_encode 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_get_ frames,該符號(hào)在函數(shù) _x264_encoder_encode 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_put_frame,該符號(hào)在函數(shù) _x264_encoder_encode 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_delete,該符號(hào)在函數(shù) _x264_encoder_close 中被引用
1>libx264.lib(analyse.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _log2f,該符號(hào)在函數(shù) _x264_mb_analyse_load_costs 中被引用
由于最近x264_param中新添了lookahead,而對(duì)應(yīng)Win32工程是沒(méi)有及時(shí)更新。
把encoder/lookahead.c添加到工程里(和encode.c放在一起)即可。
error LNK2019 unresolved external symbol _log2f
另外,如果最后出現(xiàn)error LNK2019 unresolved external symbol _log2f, 在 osdep.h 里定義一下log2f( 不知道性能如何) :
#ifdef _MSC_VER
#define inline __inline
#define strcasecmp stricmp
#define strncasecmp strnicmp
#define snprintf _snprintf
#define fseek _fseeki64
#define ftell _ftelli64
#define isfinite _finite
#define strtok_r strtok_s
#define _CRT_SECURE_NO_DEPRECATE
#define X264_VERSION "" // no configure script for msvc
#define log2f(x) (logf(x)*1.4426950408889634f)
#endif
或 :
#define log2f(x) ??? ((float)log((double)(x)))/(log((double)2))
科普開始
1、編譯問(wèn)題
由于MS的VS編譯器對(duì)C99標(biāo)準(zhǔn)支持不好,不支持函數(shù)當(dāng)中混合定義、聲明變量。
解決辦法:在函數(shù)開頭統(tǒng)一定義變量
e.g
編譯不過(guò)
void funA() { ?? ?? ?? ?? ?? ?? ?? ?? ?? void funA() {
int i,j; ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? int i,j,x;
i = 0; ?? ?? ?? ========> ?? ?? i = 0;
int x = 0; ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??? x = 0;
} ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??? }
2、鏈接問(wèn)題
libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_init,該符號(hào)在函數(shù) _x264_encoder_open_75 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_is_empty,該符號(hào)在函數(shù) _x264_encoder_encode 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_get_ frames,該符號(hào)在函數(shù) _x264_encoder_encode 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_put_frame,該符號(hào)在函數(shù) _x264_encoder_encode 中被引用
1>libx264.lib(encoder.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _x264_lookahead_delete,該符號(hào)在函數(shù) _x264_encoder_close 中被引用
1>libx264.lib(analyse.obj) : error LNK2019: 無(wú)法解析的外部符號(hào) _log2f,該符號(hào)在函數(shù) _x264_mb_analyse_load_costs 中被引用
由于最近x264_param中新添了lookahead,而對(duì)應(yīng)Win32工程是沒(méi)有及時(shí)更新。
把encoder/lookahead.c添加到工程里(和encode.c放在一起)即可。
error LNK2019 unresolved external symbol _log2f
另外,如果最后出現(xiàn)error LNK2019 unresolved external symbol _log2f, 在 osdep.h 里定義一下log2f( 不知道性能如何) :
#ifdef _MSC_VER
#define inline __inline
#define strcasecmp stricmp
#define strncasecmp strnicmp
#define snprintf _snprintf
#define fseek _fseeki64
#define ftell _ftelli64
#define isfinite _finite
#define strtok_r strtok_s
#define _CRT_SECURE_NO_DEPRECATE
#define X264_VERSION "" // no configure script for msvc
#define log2f(x) (logf(x)*1.4426950408889634f)
#endif
或 :
#define log2f(x) ??? ((float)log((double)(x)))/(log((double)2))
總結(jié)
以上是生活随笔為你收集整理的VS2008下最新X264(svn 2009.9)编译不过的解决办法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Mac系统Safari浏览器启动无图模式
- 下一篇: sns.kdeplot()核密度估计图