Q: Other linker flag -ObjC caused "Symbol not found" error I have a pure Objective-C project which structures like this


*

*Custom static library linked to App target and Today extension target, used for sharing/reusing code

*Static library contains AFNetworking library installed by CocoaPods (with use_frameworks! disabled)

*iOS today extension contains Masonry library installed by CocoaPods (with use_frameworks! disabled)

When installing Masonry to today extension, CocoaPods adds -ObjC to Other Linker Flag in my today extension target, which will cause a Undefined symbol error when compiling extension target. 

However, if I remove the -ObjC flag, the project will compile successfully, I have no idea of how this happens. I've search through the internet, the only thing I know is that -ObjC flag will 

Causes the linker to load every object file in the library that
  defines an Objective-C class or category

But I don't know why this behavior ends up a compile error.
This is a test projected I've created to reproduce the issue: https://github.com/JohnnyTseng/SimpleProject
The project will now result in a "Undefined symbol" compile error, but if you remove the 


*

*${inherited}

*-ObjC
flag from the SimpleTodayExtension, it will compile with no error

Although the project compiles fine with -ObjC flag removed, but I am very curious of what has happened behind scene, it will be appreciated if someone can teach me how it happened, Thank you!

A: From clang documentation

-ObjC
Treat source input files as Objective-C inputs

-ObjC++
Treat source input files as Objective-C++ inputs


This is explicit commands, if they absent, compiler detects used language implicitly, usually by file extension. So if to follow, as usal, *.m, *.c, *.cpp then all is OK, what actually you observe.
