2013-12-22 50 views
1

我能創造一個適當的DLL文件。一個庫裝訂機iOS圖書館與xamarin

我LinkWith文件

[assembly: LinkWith ("libSwiperAPI.a", IsCxx = true, 
    LinkTarget = LinkTarget.Simulator | LinkTarget.ArmV7 | LinkTarget.ArmV7s, 
    ForceLoad = true, Frameworks = "CoreAudio AudioToolbox AVFoundation MediaPlayer", 
    LinkerFlags = "-ObjC -lc++")] 

在此使用鏈接標誌-lstdC++ -lz,但也沒有工作嘗試。

我甚至嘗試在添加mtouch的Argjuments和-gcc_flags中添加-cxx。

當我試圖在我的演示項目中使用dll文件。我得到錯誤

Compiling to native code 
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/bin/iPhone/Debug/RoamPayAPITest.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" -r "/Users/sathish/Projects/Xamarin/RoamPayAPITest/References/SwipeAPIBinding.dll" -debug -sdk "7.0" -targetver "7.0" --abi=armv7 "-cxx" "/Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/bin/iPhone/Debug/RoamPayAPITest.exe" 
Xamarin.iOS 7.0.4 Business Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk 
warning MT3005: The dependency 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly 'monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' was not found. Please review the project's references. 
warning MT3005: The dependency 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' of the assembly 'SwipeAPIBinding, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' was not found. Please review the project's references. 
warning MT3005: The dependency 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly 'SwipeAPIBinding, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' was not found. Please review the project's references. 
warning MT3006: Could not compute a complete dependency map for the project. This will result in slower build times because Xamarin.iOS can't properly detect what needs to be rebuilt (and what does not need to be rebuilt). Please review previous warnings for more details. 
Process exited with code 1, command: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -lz -lc++ -Wl,-pie -miphoneos-version-min=7.0 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/RoamPayAPITest.exe.armv7.o /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/monotouch.dll.armv7.o /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.armv7.o /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/SwipeAPIBinding.dll.armv7.o /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/registrar.armv7.o /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/main.armv7.o -force_load /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/obj/iPhone/Debug/mtouch-cache/libSwiperAPI.a -o /Users/sathish/Projects/Xamarin/RoamPayAPITest/RoamPayAPITest/bin/iPhone/Debug/RoamPayAPITest.app/RoamPayAPITest -framework CFNetwork -framework Foundation -framework CoreGraphics -framework UIKit -framework CoreAudio -framework AudioToolbox -framework AVFoundation -framework MediaPlayer -lz -liconv -u _mono_pmip -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_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 
Undefined symbols for architecture armv7: 
    "std::ios_base::Init::Init()", referenced from: 
     __GLOBAL__I_a in libSwiperAPI.a(DownSample.o) 
     __GLOBAL__I_a in libSwiperAPI.a(FskController.o) 
     __GLOBAL__I_a in libSwiperAPI.a(WavBuffer.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterRealTimeDecoder.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterState.o) 
    "std::ios_base::Init::~Init()", referenced from: 
     __GLOBAL__I_a in libSwiperAPI.a(DownSample.o) 
     __GLOBAL__I_a in libSwiperAPI.a(FskController.o) 
     __GLOBAL__I_a in libSwiperAPI.a(WavBuffer.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterRealTimeDecoder.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterState.o) 
     __GLOBAL__I_a in libSwiperAPI.a(DownSample.o) 
     __GLOBAL__I_a in libSwiperAPI.a(FskController.o) 
     __GLOBAL__I_a in libSwiperAPI.a(WavBuffer.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterRealTimeDecoder.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterState.o) 
     __GLOBAL__I_a in libSwiperAPI.a(DownSample.o) 
     __GLOBAL__I_a in libSwiperAPI.a(FskController.o) 
     __GLOBAL__I_a in libSwiperAPI.a(WavBuffer.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterRealTimeDecoder.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterState.o) 
     __GLOBAL__I_a in libSwiperAPI.a(DownSample.o) 
     __GLOBAL__I_a in libSwiperAPI.a(FskController.o) 
     __GLOBAL__I_a in libSwiperAPI.a(WavBuffer.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterRealTimeDecoder.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterState.o) 
     __GLOBAL__I_a in libSwiperAPI.a(DownSample.o) 
     __GLOBAL__I_a in libSwiperAPI.a(FskController.o) 
     __GLOBAL__I_a in libSwiperAPI.a(WavBuffer.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterRealTimeDecoder.o) 
     __GLOBAL__I_a in libSwiperAPI.a(AE_ManchesterState.o) 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
    error MT5210: Native linking failed, undefined symbol: std::ios_base::Init::Init().  
    Please verify that all the necessary frameworks have been referenced and native 
    libraries are properly linked in. 

    error MT5210: Native linking failed, undefined symbol: std::ios_base::Init::~Init(). 
    Please verify that all the necessary frameworks have been referenced and native 
    libraries are properly linked in. 

    error MT5202: Native linking failed. Please review the build log. 

有人可以幫我解決這個問題。

回答

1

終於想出了錯誤!

[assembly: LinkWith (..., LinkerFlags = "-lstdc++ -lz")] 

在iOS系統中綁定謨

選項>生成>編譯器>添加參數

-cxx -gcc_flags "-stdlib=libstdc++ -L${ProjectDir} -lMylibrary -force_load ${ProjectDir}/libMylibrary.a」 

在我的演示應用程序

選項>的iOS Buidl> Addtional型mTouch參數

--gcc_flags="-stdlib=libstdc++" 

通過在所有地方給予正確的標誌,它解決了我的問題。