gpt4 book ai didi

iphone - 构建应用程序时出错 : Undefined symbols for architecture armv7

转载 作者:行者123 更新时间:2023-11-30 04:28:31 24 4
gpt4 key购买 nike

我在尝试构建我的程序时遇到问题,该程序使用 C++ 类来延迟 FFmpeg 对象:

    Undefined symbols for architecture armv7:
"__Z13avcodec_open2P14AVCodecContextP7AVCodecPP12AVDictionary", referenced from:
__Z10openStreamPKcb in RTPReader.o
"__Z21avcodec_decode_audio4P14AVCodecContextP7AVFramePiP8AVPacket", referenced from:
__Z13getStreamDataRPhRi in RTPReader.o
"__Z20avformat_close_inputPP15AVFormatContext", referenced from:
__Z11closeStreamv in RTPReader.o
"__Z21avformat_network_initv", referenced from:
__Z10openStreamPKcb in RTPReader.o
"__Z26avcodec_get_frame_defaultsP7AVFrame", referenced from:
__Z13getStreamDataRPhRi in RTPReader.o
"__Z15av_register_allv", referenced from:
__Z10openStreamPKcb in RTPReader.o
"__Z19av_find_best_streamP15AVFormatContext11AVMediaTypeiiPP7AVCodeci", referenced from:
__Z10openStreamPKcb in RTPReader.o
"__Z14av_free_packetP8AVPacket", referenced from:
__Z13getStreamDataRPhRi in RTPReader.o
__Z11closeStreamv in RTPReader.o
"__Z6av_logPviPKcz", referenced from:
__Z10openStreamPKcb in RTPReader.o
__Z13getStreamDataRPhRi in RTPReader.o
"__Z19avformat_open_inputPP15AVFormatContextPKcP13AVInputFormatPP12AVDictionary", referenced from:
__Z10openStreamPKcb in RTPReader.o
"__Z26av_samples_get_buffer_sizePiii14AVSampleFormati", referenced from:
__Z13getStreamDataRPhRi in RTPReader.o
"__Z19avcodec_alloc_framev", referenced from:
__Z13getStreamDataRPhRi in RTPReader.o
"__Z25avformat_find_stream_infoP15AVFormatContextPP12AVDictionary", referenced from:
__Z10openStreamPKcb in RTPReader.o
"__Z13av_read_frameP15AVFormatContextP8AVPacket", referenced from:
__Z13getStreamDataRPhRi in RTPReader.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

它以某种方式为我所有的 C++ 方法添加了前缀 _Z##,我不知道为什么。

可能是什么问题?

最佳答案

您看到的所有 __Z## 东西都是正常的。它在 C++ 中称为“名称修改”,请参阅 http://en.wikipedia.org/wiki/Name_mangling一个很好的解释。

我不得不在这里做一些猜测,缺乏更详细的信息(抱歉,我还不能评论,只能回答)。查看 ffmpeg api 文档,似乎 FFmpeg 有一个 C API,而不是 C++。如果确实如此,您的解决方案可能是用 extern "C"包装所有 FFmpeg 文件的#includes,例如(参见 http://developers.sun.com/solaris/articles/mixing.html 的解释):

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

至于链接失败的原因,你是链接了一个预建的ffmpeg库,还是你的项目中包含了ffmpeg源文件?如果您链接到一个库,它可能没有正确的架构。如果您在终端窗口中运行以下命令,它会告诉您库中有哪些架构可用:

file libffmpeg.a

关于iphone - 构建应用程序时出错 : Undefined symbols for architecture armv7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10080258/

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