简体   繁体   English

无法与libx264.lib静态库链接

[英]Unable to link with libx264.lib static library

I'm building custom video encoder using x264 as a static library. 我正在使用x264作为静态库构建自定义视频编码器。 I've followed this guide in order to build static library. 我已经按照指南来构建静态库。 Trying to compile this: 试图编译这个:

x264_t * setup_encoder(int width, int height){
    x264_param_t param;
    x264_param_default_preset(&param, "veryfast", "zerolatency");
    param.i_threads = 1;
    param.i_width = width;
    param.i_height = height;
    param.i_fps_num = 26;
    param.i_fps_den = 1;
    // Intra refres:
    param.i_keyint_max = 26;
    param.b_intra_refresh = 1;
    //Rate control:
    param.rc.i_rc_method = X264_RC_CRF;
    param.rc.f_rf_constant = 25;
    param.rc.f_rf_constant = 25;
    param.rc.f_rf_constant_max = 35;
    //For streaming:
    param.b_repeat_headers = 1;
    param.b_annexb = 1;
    x264_param_apply_profile(&param, "baseline");

    return x264_encoder_open(&param);
}

Results in: 结果是:

main.obj : error LNK2019: unresolved external symbol "int __cdecl x264_param_default_preset(struct x264_param_t *,char const *,char const *)" main.obj:错误LNK2019:未解析的外部符号“int __cdecl x264_param_default_preset(struct x264_param_t *,char const *,char const *)”

main.obj : error LNK2019: unresolved external symbol "int __cdecl x264_param_apply_profile(struct x264_param_t *,char const *)" main.obj:错误LNK2019:未解析的外部符号“int __cdecl x264_param_apply_profile(struct x264_param_t *,char const *)”

main.obj : error LNK2019: unresolved external symbol "struct x264_t * __cdecl x264_encoder_open_136(struct x264_param_t *)" main.obj:错误LNK2019:未解析的外部符号“struct x264_t * __cdecl x264_encoder_open_136(struct x264_param_t *)”

%PROJECT_DIR%: fatal error LNK1120: 3 unresolved externals %PROJECT_DIR%:致命错误LNK1120:3个未解析的外部

Linker scans libx264.lib, but can't find anything inside. 链接器扫描libx264.lib,但找不到任何内容。

Searching .\lib\libx264.lib:

With dumpbin /HEADERS I can actually find the declaration I need, but linker is unable to do it. 使用dumpbin / HEADERS我实际上可以找到我需要的声明,但链接器无法做到。

SECTION HEADER #38
   .text name
       0 physical address
       0 virtual address
     E60 size of raw data
    930C file pointer to raw data (0000930C to 0000A16B)
    D219 file pointer to relocation table
       0 file pointer to line numbers
      40 number of relocations
       0 number of line numbers
60501020 flags
         Code
         COMDAT; sym= x264_param_default_preset
         16 byte align
         Execute Read

Enviroment is Visual Studio 2012 with Intel Compiler 14 on Windows 8 64-bit. Enviroment是Visual Studio 2012,在Windows 8 64位上安装了英特尔编译器14。

try including using C style bindings. 尝试包括使用C样式绑定。

extern "C" {
#include <x264.h>
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM