Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 874
auspicious99 Avatar asked Jan 31 '14 10:01

auspicious99


1 Answers

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.

EDIT

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.

like image 151
Ivan Genchev Avatar answered Nov 02 '22 05:11

Ivan Genchev