ios - undefined symbol av_register_all()

标签 ios objective-c xcode ffmpeg

你好,

我是 Objective-C 和 Xcode IDE 的初学者。我正在尝试在我的 iOS 应用程序中使用 ffmpeg。我克隆了 https://github.com/kewlbear/FFmpeg-iOS-build-script并为 arm64 和 x86_64 构建。

当我想构建应用程序时它崩溃了

Ld /Users/nikolajpognerebko/Library/Developer/Xcode/DerivedData/CPP3-eowdhpsbeagmxydsrsscofhtuwtl/Build/Products/Debug-iphonesimulator/CPP3.app/CPP3 normal x86_64
cd /Volumes/sedy/xcode/CPP3
export IPHONEOS_DEPLOYMENT_TARGET=9.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -L/Users/nikolajpognerebko/Library/Developer/Xcode/DerivedData/CPP3-eowdhpsbeagmxydsrsscofhtuwtl/Build/Products/Debug-iphonesimulator -L/Volumes/sedy/xcode/CPP3/CPP3/ffmpeg/lib -F/Users/nikolajpognerebko/Library/Developer/Xcode/DerivedData/CPP3-eowdhpsbeagmxydsrsscofhtuwtl/Build/Products/Debug-iphonesimulator -filelist /Users/nikolajpognerebko/Library/Developer/Xcode/DerivedData/CPP3-eowdhpsbeagmxydsrsscofhtuwtl/Build/Intermediates/CPP3.build/Debug-iphonesimulator/CPP3.build/Objects-normal/x86_64/CPP3.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.1 -Xlinker -objc_abi_version -Xlinker 2 -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lswscale -framework AVFoundation -liconv -lbz2 -Xlinker -dependency_info -Xlinker /Users/nikolajpognerebko/Library/Developer/Xcode/DerivedData/CPP3-eowdhpsbeagmxydsrsscofhtuwtl/Build/Intermediates/CPP3.build/Debug-iphonesimulator/CPP3.build/Objects-normal/x86_64/CPP3_dependency_info.dat -o /Users/nikolajpognerebko/Library/Developer/Xcode/DerivedData/CPP3-eowdhpsbeagmxydsrsscofhtuwtl/Build/Products/Debug-iphonesimulator/CPP3.app/CPP3

Undefined symbols for architecture x86_64:
  "av_register_all()", referenced from:
      Decoder::Decoder() in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

OneDrive 上有压缩项目 http://1drv.ms/1KkPAia因为这是解释我的问题的最佳方式。

请帮我解释一下,这是什么问题。

非常感谢。

最佳答案

我猜你没有使用 extern "C"(像这样:

extern "C" {
#include "libavformat/avformat.h"
}

) 围绕 ffmpeg (libavcodec/libavformat) header 的每个 #include 语句?这在访问 C 代码的 C++ 代码中是必需的。

关于ios - undefined symbol av_register_all(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32592089/

相关文章:

ios - 尝试将元素连接/添加到 Xcode 7.3 中的 View Controller 时,我收到锁定警报

ios - 在 for 循环中使用日期格式化程序的 dateFromString api 会产生巨大的内存问题

Xcode 10 上的 iOS 模拟器崩溃

ios - 如何使用 UIWebView 或 WKWebView 在后台连续播放音乐

ios - SWRevealViewController - 添加 GestureRecognizer 以查看停止 UITableViewCell 工作

ios - UICollectionView 布局自定义

iphone - 半透明导航栏的 iOS 间距问题

xcode - Xcode 4.为什么我重命名的项目找不到它的Info.plist文件?

ios - 无法使用 CloudKit 的 CKQueryOperation 从 iCloud 获取数据

ios - Swift - 在 KeyWindow 的 subview 中无法识别点击手势