3

I can't figure out why I can't get this project to archive. It gives me the error:

clang: error: cannot specify both '-fobjc-arc' and '-fobjc-gc'

I have already looked here clang: error: cannot specify both '-fobjc-arc' and '-fobjc-gc' and that didn't help me, so how can I figure this? I need to use _bridge otherwise it will give my a memory leak. I want to run this on 10.8 Mac OSX. Thank you.

Community
  • 1
  • 1
italiano40
  • 496
  • 9
  • 18

1 Answers1

2

Here is a guess, all anyone can do with the information provided:

The option -fobjc-arc instructs the compiler to compile a file for ARC, while -fobj-gc instructs the compiler to compile a file for GC (garbage collection, deprecated). You can't compile a file for both, or mix ARC-compiled and GC-compiled code.

These options can be set for a whole project in the "Build Settings" pane of the project settings, and on a per-file basis in the "Compile Sources" section of "Build Phases" pane of the project settings. There are different settings for "Debug" and "Release" (the latter is used for "Archive") builds.

So the guess is you have different Debug & Release settings for these flags as you say the issue only arises for "Archive". Carefully check through your project settings.

HTH

CRD
  • 52,522
  • 5
  • 70
  • 86
  • So where in my build settings is that? In my build phases, I have nothing set under my compile sources, no flags. I need just arc since I need to use _bridge. – italiano40 Aug 30 '13 at 03:26
  • 2
    I fixed it, it is in the user-defined settings under "GCC_ENABLED_OBJC_GC" hence why search wasn't finding it! – italiano40 Aug 30 '13 at 03:39
  • @italiano40 you're right, same thing happened to my project. Thanks. – Tonny Xu Oct 06 '13 at 06:10