Linker flags for iOS with Xcode

Where can I find documentation on the compiler flags and linker flags that we can specify for our iOS projects in Xcode?

The present reason I want to read more on the possible flags in the first place is that the Google Admob SDK says we MUST set the linker -Objc flag, whereas Facebook SDK suggests NOT setting it for smaller binaries. So, I was wondering, can we set Objc for a particular library (google admob in this case) and have it unset for another library (facebook)? I expected to be able to find a man page or some other doc about what the compiler and linker options are in the first place, and then zoom in on Objc. There's tons of documentation and stackoverflow posts etc. on how to set linker flags in Xcode. What's lacking is a listing of possible linker flags we can set, and what they each mean.

Surprisingly, googling around made me quite confused, as there's stuff on clang, llvm, llvm-gcc, etc., and LLVM site lists a number of llvm commands but I don't see -Objc listed in any of the corresponding pages. Apart from the question of whether the compiler and linker are clang or llvm, or whatever they're called, is there a place we could go to in order to read documentation on whatever Xcode is currently using by default for compiling and linking iOS projects? (say, both Xcode 4.6 and Xcode 5.0.2, in case there are different doc sets?) Thanks!


You can try man 1 ld. For the -ObjC flag in particular the description is:

-ObjC Loads all members of static archive libraries that implement an Objective-C class or category.


For your other question about the AdMob SDK and the Facebook SDK, I would suggest to add the -ObjC to the linker flags and take a look at this article which explains why. Basically Facebook suggests not to use it, because your executable will end up being larger due to additional object code loaded into your binary.

I had this problem when I put a function into my .hpp file.

void logError(char const* szError)

I had to add in the inline to make it work.

inline void logError(char const* szError)

Even better don't define your functions inside your headers.

Need Your Help

How should the Web API access token be stored?

There are some similar topics here in Stackflow but I find none of them has answered my question.

Continue button on one page checkout does not move to next step (step 2 to step 3) in Magento

php magento magento-1.7

I am using Magento ver. When I click on "ship to this address" at one page checkout then Continue botton is not working. Its only highlights the next step (Shipping Information) but not op...