gpt4 book ai didi

xcode - 从 QtApp 链接到 FFmpeg 时出现 libavcodec.a 链接器错误

转载 作者:行者123 更新时间:2023-12-04 23:26:09 25 4
gpt4 key购买 nike

我正在尝试链接我的 Qt 应用程序 FFmpeg .我使用 here 中的脚本从源代码构建 FFmpeg 作为静态库.并且,来自 here 的 x264 .

构建没问题。以下是我用于 FFmpeg 的配置标志:

CONFIGURE_FLAGS="--enable-cross-compile --enable-debug --disable-programs --enable-postproc \
--enable-swscale --enable-avfilter --enable-avresample \
--disable-doc --enable-pic --enable-static --disable-opencl --disable-shared --disable-securetransport \
--enable-videotoolbox --enable-audiotoolbox --enable-gpl"

为 x264 配置标志:
CONFIGURE_FLAGS="--enable-static --enable-pic --disable-cli --disable-asm"

以下是我如何从我的 QtApp 链接库 尝试为 MacOSX 构建它 :
LIBS+= -LPath/to/ffmpeg/build/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample \ 
-lavdevice -lpostproc -lx264 -lz -llzma -lbz2 -framework CoreVideo -framework CoreFoundation -framework CoreMedia \
-framework VideoToolbox -framework AudioToolbox -framework OpenAL -framework CoreServices -framework AVFoundation \
-framework QuartzCore -framework CoreGraphics

我包括 FFmpeg标题也推荐:
#ifdef __cplusplus
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/frame.h>
}
#endif

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#define av_frame_alloc avcodec_alloc_frame
#endif

问题:
但是 当我调用 av_register_all .我收到以下链接器错误。
Undefined symbols for architecture x86_64:
"_VDADecoderCreate", referenced from:
_ff_vda_create_decoder in libavcodec.a(vda_h264.o)
_ff_vda_default_init in libavcodec.a(vda_h264.o)
"_VDADecoderDecode", referenced from:
_vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
_vda_h264_end_frame in libavcodec.a(vda_h264.o)
"_VDADecoderDestroy", referenced from:
_ff_vda_destroy_decoder in libavcodec.a(vda_h264.o)
"_VDADecoderFlush", referenced from:
_vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
_vda_h264_end_frame in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_Height", referenced from:
_ff_vda_create_decoder in libavcodec.a(vda_h264.o)
_ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_SourceFormat", referenced from:
_ff_vda_create_decoder in libavcodec.a(vda_h264.o)
_ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_Width", referenced from:
_ff_vda_create_decoder in libavcodec.a(vda_h264.o)
_ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_avcCData", referenced from:
_ff_vda_create_decoder in libavcodec.a(vda_h264.o)
_ff_vda_default_init in libavcodec.a(vda_h264.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题:
我在这里想念什么?

最佳答案

固定 它。链接器列表中缺少以下内容

LIBS += -framework VideoDecodeAcceleration

这修复了与 libavcodec.a(vda_h264.o) 相关的所有链接器问题。
是的。

关于xcode - 从 QtApp 链接到 FFmpeg 时出现 libavcodec.a 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46533265/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com