I have an Objective C static library that I am trying to import into MonoTouch using btouch. The problem that I am encountering, though, is that the library depends on libz.dylib and libxml2.dylib and I do not know how to include these frameworks in my MonoTouch application.
I have tested the static library in an XCode project and this test application compiles and runs correctly. I am now trying to build exactly the same sample application in MonoTouch, and am having problems getting the gcc_flags arguments right so that all the dependencies are included.
In the XCode application, the following frameworks needed to be included:
UIKit.framework
CFNetwork.framework
CoreGraphics.framework
Foundation.framework
MobileCoreServices.framework
SystemConfiguration.framework
libz.dylib
libxml2.dylib
Also, in XCode, I had to include the following search path for it to find all the required header files: "$(SDK_DIR)"/usr/include/libxml2
Now, in MonoTouch I have the following set in my gcc_flags under the build options:
-v -v -v -gcc_flags "-framework CFNetwork -framework CoreGraphics -framework Foundation -framework MobileCoreServices -framework SystemConfiguration -I${ProjectDir}/lib/include -I$(SDK_DIR)/usr/include/libxml2 -L${ProjectDir}/lib/ -lOfflineRequest -force_load ${ProjectDir}/lib/libOfflineRequest.a"
When I try compile I get a long list of linking errors, which as far as I can tell are caused by libz.dylib and libxml2.dylib not being in开发者_如何学Ccluded during the linking. Does anyone have any idea how I can ensure that these get included in MonoTouch?
Try adding "-lz -lxml2" to the --gcc_flags you already have. That will instruct the gcc to add libz and libxml2 when linking the application.
If this does not work then please post the full build log (edit your message or fill a bug report in bugzilla.xamarin.com and attach the build log).
精彩评论