gpt4 book ai didi

binding - 无法链接 MonoTouch 项目中的 native 库 - 找不到 -lName 的库

转载 作者:行者123 更新时间:2023-12-02 18:42:53 26 4
gpt4 key购买 nike

我已经编译了 flacios library在 xcode 中。然后我从框架文件夹中提取了一个“胖二进制文件”(为这个特定的 xcode 项目构建工件)并将其重命名为 libFLACiOS.a。

然后我将其添加到 MonoTouch 应用程序项目中。创建了一个 NativeMethods 包装类,我在其中导入需要使用的 native 方法,并向项目选项添加了 gcc 标志:

-cxx -gcc_flags "-std=c++11 -stdlib=libc++ -lc++ -v -Wall -L${ProjectDir} -lFLACiOS -framework AVFoundation -force_load ${ProjectDir}/libFLACiOS.a

现在,似乎我已经完成了导入工作所需的所有操作,但是当我尝试构建项目时,出现以下构建错误:

/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/bin/iPhone/Debug/Sigmo.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -debug -linksdkonly -sdk "7.1" -targetver "7.0" --abi=armv7 "-cxx" --gcc_flags "\"-std=c++11\" \"-stdlib=libc++\" \"-lc++\" \"-v\" \"-Wall\" \"-L/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo\" \"-lFLACiOS\" \"-framework\" \"AVFoundation\" \"-force_load\" \"/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/libFLACiOS.a\"" "/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/bin/iPhone/Debug/Sigmo.exe"
Xamarin.iOS 7.2.5 Trial Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -Wl,-pie -miphoneos-version-min=7.0 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/Sigmo.exe.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/monotouch.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/System.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/System.Core.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/registrar.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/main.armv7.o -o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/bin/iPhone/Debug/Sigmo.app/Sigmo -framework CFNetwork -framework AVFoundation -framework QuartzCore -framework CoreBluetooth -framework Foundation -framework AudioToolbox -framework CoreGraphics -framework UIKit -lz -liconv -u _mono_pmip -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _xamarin_get_block_descriptor -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_log /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonoboehm-2.0.a /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonotouch-debug.a "-std=c++11" "-stdlib=libc++" "-lc++" "-v" "-Wall" "-L/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo" "-lFLACiOS" "-framework" "AVFoundation" "-force_load" "/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/libFLACiOS.a"
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: arm-apple-darwin13.3.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch armv7 -force_load /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/libFLACiOS.a -iphoneos_version_min 7.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -u _mono_pmip -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _xamarin_get_block_descriptor -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_log -o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/bin/iPhone/Debug/Sigmo.app/Sigmo -L/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo -pie /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/Sigmo.exe.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/monotouch.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/System.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/System.Core.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/registrar.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/main.armv7.o -framework CFNetwork -framework AVFoundation -framework QuartzCore -framework CoreBluetooth -framework Foundation -framework AudioToolbox -framework CoreGraphics -framework UIKit -lz -liconv /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonoboehm-2.0.a /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonotouch-debug.a -lc++ -lFLACiOS -framework AVFoundation -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.ios.a
Undefined symbols for architecture armv7:
"std::string::c_str() const", referenced from:
FLAC::Decoder::File::init(std::string const&) in libFLACiOS.a(stream_decoder-823A661D997F1576.o)
FLAC::Decoder::File::init_ogg(std::string const&) in libFLACiOS.a(stream_decoder-823A661D997F1576.o)
FLAC::Encoder::File::init(std::string const&) in libFLACiOS.a(stream_encoder-20FCC1D902B5C661.o)
FLAC::Encoder::File::init_ogg(std::string const&) in libFLACiOS.a(stream_encoder-20FCC1D902B5C661.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error MT5309: Native linking error: Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
error MT5309: Native linking error: Target: arm-apple-darwin13.3.0
error MT5309: Native linking error: Thread model: posix
error MT5309: Native linking error: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch armv7 -force_load /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/libFLACiOS.a -iphoneos_version_min 7.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -u _mono_pmip -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _xamarin_get_block_descriptor -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_log -o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/bin/iPhone/Debug/Sigmo.app/Sigmo -L/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo -pie /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/Sigmo.exe.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/monotouch.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/System.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/System.Core.dll.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/registrar.armv7.o /Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/obj/iPhone/Debug/mtouch-cache/main.armv7.o -framework CFNetwork -framework AVFoundation -framework QuartzCore -framework CoreBluetooth -framework Foundation -framework AudioToolbox -framework CoreGraphics -framework UIKit -lz -liconv /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonoboehm-2.0.a /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonotouch-debug.a -lc++ -lFLACiOS -framework AVFoundation -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.ios.a
error MT5210: Native linking failed, undefined symbol: std::string::c_str() const. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: "-std=c++11" "-stdlib=libc++" "-lc++" "-v" "-Wall" "-L/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo" "-lFLACiOS" "-framework" "AVFoundation" "-force_load" "/Users/maxpavlov/Perforce/max.pavlov_Moment_5440/Mobile/Sigmo/SigmoIOS/Sigmo/libFLACiOS.a"
error MT5202: Native linking failed. Please review the build log.

最佳答案

由于 -lFLAC,您似乎正在告诉 native 链接器链接 FLAC.a

但是您说 FLACiOS.a 存在,这是一个不同的文件名。您是否尝试更改此设置以匹配,即 -lFLACiOS

关于binding - 无法链接 MonoTouch 项目中的 native 库 - 找不到 -lName 的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24952852/

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