2

My Xcode project has a two frameworks: one of them requires other linker flags -ObjC in order to compile, but when the -ObjC flag is used, the second can't compile and shows many errors.

Is there a way to compile a project without the -ObjC flag when a specific framework requires it?

jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

1

I haven't tried this but it might very well work:

what -objc does is basically loading symbols (of categories) that are the linker doesn't find because they don't seem used. See this answer for more details:
Why is the -ObjC linker flag needed to link categories in static libraries? (LLVM)

so you should very well be able to emulate this with the -all_load linker flag

BUT that doesn't help you because that would still affect all your linked libraries


BUT you can tell load_all to only affect certain libs.. you'd use -force_load %NAMEOFLIB%

That way, you might get around -ObjC

Community
  • 1
  • 1
Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • Thank you so much. Just two questions, if you don't mind: how can I retrieve the %NAMEOFLIB% based on the Framework name that shows on the left side bar of Xcode? And should I -force_load the lib what requires -ObjC or the one that doesn't? – connieconnect83 Oct 06 '14 at 10:01
  • force load the one that requires objC. – Daij-Djan Oct 06 '14 at 12:50
  • the path should be along the lines if a.framework/libA.a or the limey - you need an a id say – Daij-Djan Oct 06 '14 at 12:51