Linking libcsoap to iPhone project in Xcode - objective-c

I have an iPhone project that I want to use libcsoap in to make service calls. I'm having trouble linking a pure c library to xCode though. I've tried everything short of manually rebuilding the project as an Xcode project.
I built it via command line (./configure; make; make install). Then linked the output (libcsoap.a) and connected to the headers. This gave me a linker error saying that libcsoap.a was built for archiving and couldn't be used.
I tried creating a project out of just the makefile but that failed to build.
Can anybody explain to me what I should do to link these?
Thanks in advance,
George

Related

Can MBED CLI 2 build a multiple directory project or do I need CMAKE?

I am trying to make the transtition from MBED Studio to VSCode.
I have succesfully compiled and debugged the Blinky example.
I now want to create a large project with many subdirectories.
When I create a new library, and include it’s header in the main.cpp, and try building using MBED CLI2 I get:
myLibrary.hpp: No such file or directory.
Compilation terminated.
Perhaps I have misunderstood the functionality of MBED CLI2, but I thought that it could behave like MBED Studio and could build a project, afterwhich convert it to a CMAKE-build.
So the question is, do I need cmake?
Thanks in advance,
Will

Linker error for imported header file Xcode 4.5

I have downloaded a header file and static library file (.a file) from the internet. They are provided by the wireless printer which i bought for my iphone and trying to make print functionality working in my app. The problem is when I run the sample app provided by them to test printer, I get the following linker error...Obviously the app was designed in the previous versions of Xcode and Im using Xcode 4.5. Much appreciated if someone could Guide me..
If you are building an iOS project and it's using the i386 architecture, then you must be building for the simulator. What happens when you build for an actual iOS device?
It's possible that the library was compiled only for the processor architectures for real iOS devices, typically armv6, armv7, or armv7s. You can use the file command in Terminal to see what architectures are in the .a library file.
Check these answers Symbols not found for architecture i386? and symbols not found.
Check your project-> build phases -> Link Binary With Libraries whether there is libwspr240.a file is there or not.
Remove libwspr240.a file and then readd it using
Project --> Build Phases --> Link Binary with Libraries click '+' button to add.
Then Clean and Build the project

Xcode: how to build a static library project correctly?

This question will be easy for Xcode pros but for a MonoTouch developer it seems to be impossible to resolve. :-)
I'm using Xcode 4.5 and I want to target iOS 5.1 and above and iOS Simulator 5.1 and above.
I have a a library project here and it is coming with a prebuilt binary named "DemoLib" (no extension and it is 11MB in size). The library is a fat lib for Simulator and iOS 5.1+.
I can use that library without any problem.
However if I try to build the library myself, I end up with a "DemoLib.a" file (notice the extension and the size of 30MB). How can I get the same build result? What is a .a file compared to the file without extension?
I tried to build the project "for running", and "for archiving" in Xcode. Both results in the same 30MB .a file.
I was expecting some dropdown in Xcode where one could select "DEBUG" or "RELEASE" build and the latter one would create the smaller lib.
Of course I could never tell without seeing the framework's project file. Having said that, there is an excellent guide to creating and compiling iOS frameworks here: https://github.com/jverkoey/iOS-Framework
Using the above guide, you should be able to recreate your framework's project from scratch, add the files you have to it, and properly compile it.
Hope this helps! :)
Did it come with a Makefile? Create a new target, set the build settings of the target to what's in the Makefile, then set your project to depend on that new target.
A file with the .a is a static library, which means it depends on nothing external and all the code it needs is compiled inside it. I think no extension generally implies dynamic library, which means it'll depend on some dependencies being present on your system to link against. Maybe that's why the .a is so much bigger. I think Xcode will build static by default because iOS does not allow the use of dynamic libraries.
The dropdown for what to build is in your scheme. Command+shift+< to view your scheme. Within the scheme you can edit which environment each method of building will use.

PhoneGap template-based app failing to compile AdWhirl sources

Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I cant find it now :( - PhoneGap is a static framework).
The app works ok on its own.
Now trying to add in AdWhirl. AdWhirl comes as source files - no library of its own, although there are libraries for the specific ad services you use.
I have added the folders to the project, but it does not seem to compile the AdWhirl sources - if amend/break the AdWhirl code, I get no compile errors.
Where I have included/imported the AdWhirl headers into my app, I had to tweak the related imports in AdWhirl files to find their dependancies - seems to be related to issue above.
I can get it compiling with that hack - but then fails to link - missing AdWhirlView, which also seems to be due to first issue - not being compiled, so not available to link.
Under build phases/compile sources, I have just 2 items: main.m and AppDelegate.m - do I need to add the AdWhirl code into here?
Here is a sample project with just the AdWhirl stuff, no PhoneGap, but still has the issue :(
Thanks in advance for any tips/pointers.
Just wanted to post the answer here that I gave on Twitter. Seems like the issue is that Xcode is unhappy with folder references. Try reimporting the AdWhirl files into your project, but tell Xcode to add groups for folders, rather than folder references. (Incidentally, if anyone knows why Xcode is choking on the folder references, I'd love to hear about it.)
Then, you'll start getting errors about ARC and missing files pertaining to the Google Ads framework. So, you'll have to add the Google Ads files to quell the errors; then, you'll want to make sure ARC is disabled in your project. If you want to use ARC, then your best bet is to repackage AdWhirl as a static library that builds without ARC, and have that as a dependency in your workspace.

Xcode force_load not working for simulator build

I am using Xcode 4 and LLVM 2 for a workspace which has two projects (A and B) in it. The main project (A) links against the binary of the other project (B) which builds a static library.
Project B contains categories so in order for it to link into A properly I set the ObjC and all_load linker flags. This however caused problems because some of our libraries that I use have symbols that should not be loaded so I tried to move over to using force_load specifically on the library file of project B.
-force_load $(TARGET_BUILD_DIR)/libB.a
This makes things work on the device however in the simulator the app crashes because categories from project B are not being linked in.
Any idea why force_load works differently on device and simulator?
Let me know if you need more details.
Try -Wl,-force_load,$(TARGET_BUILD_DIR)/libB.a; IIRC, it's a known issue that Apple LLVM Compiler 2.0 doesn't honor -force-load.