【问题标题】:Errors While Compiling ffmpeg and opencv编译ffmpeg和opencv时出错
【发布时间】:2012-03-28 01:03:10
【问题描述】:

我正在尝试编译this example

在 Ubunto 上。这是编译命令:

    g++ video.cpp -o video `pkg-config --cflags opencv` `pkg-config --libs opencv` -lpthread -lavutil -lavformat -lavcodec -lz

这是我得到的错误:

     /usr/local/include/libavutil/common.h:173:47: error: ‘UINT64_C’ was not declared in this scope
     video.cpp: In member function ‘int FFread::init(char*)’:
     video.cpp:24:56: error: ‘av_open_input_file’ was not declared in this scope
     video.cpp:28:5: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated      (declared at /usr/local/include/libavformat/avformat.h:1266) [-Wdeprecated-declarations]
     video.cpp:28:35: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1266) [-Wdeprecated-declarations]
     video.cpp:32:36: error: ‘dump_format’ was not declared in this scope
     video.cpp:37:48: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope

请指教。 谢谢, 那鸿

【问题讨论】:

  • 请使用代码标签(大括号:{} 图标)重新格式化您的问题,以使错误输出更具可读性。

标签: ubuntu opencv ffmpeg


【解决方案1】:

据我记得,你应该使用 cmake 来构建 opencv。 cmake 在 c 编译器、库支持、线程库等方面检查您的环境,并在编译中自动设置一些标志。所以不要尝试自己编译。只需按照这里的步骤http://opencv.willowgarage.com/wiki/InstallGuide_Linux

【讨论】:

    【解决方案2】:

    您正在从 C++ 程序调用 FFmpeg 库。您是否将#include 调用包装到相关标头中

    extern "C" { ... }
    

    构造?标头没有自动 C++ 支持。

    编辑:

    我阅读了链接的示例源;它做正确的事。

    我认为问题在于版本差异。该示例已有 2 年多的历史,并且 FFmpeg API 已继续使用。您可能需要自行升级 API 调用。

    【讨论】:

      【解决方案3】:

      参见 libav faq.txi

      @我在我的 C++ 应用程序中使用 Libav,但链接器抱怨缺少似乎可用的符号。

      Libav 是一个使用 C99 数学特性的纯 C 项目,以启用 C++ 要使用它们,您必须将 -D__STDC_CONSTANT_MACROS 附加到您的 CXXFLAGS

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-04-02
        • 2012-08-29
        • 2012-03-08
        • 2014-11-23
        • 2013-04-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多