你好,
我是 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/