问题
What is Mach-O type in Build Setting in Xcode? and what should it be Set on?
it has these options "Executable" "Dynamic Library" "Bundle" "Static Library" "Relocatable Object File"
I had an error "Apple Mach-O Linker Error Group" since I changed it from Executable to Static Library my error went off, I wanna know is that ok that I changed it? and what all those options mean so I won't face another error in the future.
回答1:
For more detail Building Mach-O Files and Xcode Build Setting Reference
回答2:
To setup Mach-O Type
[Mach-O format] determines a linker behaviour
Framework target -> Build Settings -> Mach-O Type
Executable
- Is not linked. Is used to create a launcheble program -Application
.Application target
is a default settingBundle
-loadable bundle
- run time linked. iOS now supports onlyTesting Bundle target
where it is a default setting to generate aLoadable bundle
.System
->Testing Bundle
->tested binary
. A location ofTesting Bundle
will be depended on target, static or dynamic binary...Dynamic Library
- Load/run time linked.Framework target
-Dynamic Library
is a default setting to generate aDynamic framework
Static Library
- Compilation time(build time) linked.Static Library target
-Static Library
is a default setting to generate aStatic library
Framework target
-Static Library
to generate aStatic framework
Relocatable Object File
- Compilation time(build time) linked. It is a kind ofStatic Library
extension. All.o
files will be relinked at build time and a new single object file will be generated. For example it can be used forSymbols hidden by default
. It is simple to check usingotool
[About] command
//Relocatable Object File
otool -L "libRelocatable.a"
Archive : /libRelocatable.a
/libRelocatable.a(relocatable_object_file.o):
/libRelocatable.a(MyClass.o):
//Static library
otool -L "/libStatic.a"
/libStatic.a:
[Vocabulary]
[Framework static vs dynamic]
来源:https://stackoverflow.com/questions/45300314/what-is-mach-o-type-should-i-use-it-in-my-ios-objective-c-project