我已按照https://university.xamarin.com/lightninglectures/ios-bindings-in-cc中的所有步骤在Xamarin iOS应用中映射C库。 但是当我尝试构建xamarin IOS应用程序时,它会给出以下错误。
Tool /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch execution started with arguments: --cache /Users/san/Projects/ExampleLib/simpleBindings/obj/iPhoneSimulator/Debug/mtouch-cache --sim /Users/san/Projects/ExampleLib/simpleBindings/bin/iPhoneSimulator/Debug/simpleBindings.app --executable simpleBindings --debug --nolink --sdkroot /Applications/Xcode.app/Contents/Developer --sdk 10.2 --targetver 10.2 --http-message-handler=HttpClientHandler --tls-provider=default --abi=x86_64 --symbollist /Users/san/Projects/ExampleLib/simpleBindings/obj/iPhoneSimulator/Debug/mtouch-symbols.list --dsym=no -cxx -lexample -force_load /Users/san/Projects/ExampleLib/simpleBindings/libexample.a” --gcc_flags “-L/Users/san/Projects/ExampleLib/simpleBindings -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Xml.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Core.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll -r /Users/san/Projects/ExampleLib/ExampleLib/bin/Debug/ExampleLib.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/mscorlib.dll -r /Users/san/Projects/ExampleLib/ExampleLib/bin/Debug/ExampleLib.dll --target-framework Xamarin.iOS,v1.0 /Users/san/Projects/ExampleLib/simpleBindings/bin/iPhoneSimulator/Debug//simpleBindings.exe -v -v
MTOUCH: error MT0010: Could not parse the command line arguments: Mono.Options.OptionException: Cannot use unregistered option 'o' in bundle '-force_load'.
at Mono.Options.OptionSet.ParseBundledValue (System.String f, System.String n, Mono.Options.OptionContext c) [0x00086] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
at Mono.Options.OptionSet.Parse (System.String argument, Mono.Options.OptionContext c) [0x000ce] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
at Mono.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments) [0x000b8] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x01667] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
Task "MTouch" execution -- FAILED
Done building target "_CompileToNative" in project "/Users/san/Projects/ExampleLib/simpleBindings/simpleBindings.csproj".-- FAILED
Done building project "/Users/san/Projects/ExampleLib/simpleBindings/simpleBindings.csproj".-- FAILED
Build FAILED.
Errors:
/Users/san/Projects/ExampleLib/simpleBindings/simpleBindings.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets (_CompileToNative target) ->
MTOUCH: error MT0010: Could not parse the command line arguments: Mono.Options.OptionException: Cannot use unregistered option 'o' in bundle '-force_load'.
答案 0 :(得分:0)
某些选项(如-force_load
)不是mtouch
的选项,而是本机链接器的选项。
它们应该在mtouch
参数下的-gcc_flags
之间引用。
您可能没有正确地将它们(错误的顺序或没有引号)添加到项目选项中的其他mtouch参数。
答案 1 :(得分:0)
由于mtouch参数中的命令复制粘贴,错误即将发生 ie -gcc_flags&#34; -L $ {ProjectDir} -lexample -force_load $ {ProjectDir} /libexample.a
在mtouch参数中手动更改双引号后问题得到解决。