4

I'm trying to integrate an additional ampp class file XMPPPubSub class from XMPP framework to my application. It says that we have to enable ARC for these files.

I have added -fobjc-arc flag against the file in Build Phases-> Compile Sources. The class has this code in it

#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to    ARC).
#endif

Even then i get this error

cc1obj: error: unrecognized command line option "-fobjc-arc"

I have seen these links already

1) How to require ARC in a class?

2) How to add ARC for specific file?

3) How to enable ARC for a single file

But yet no luck. Am i missing something here?

Please give some suggestions

Community
  • 1
  • 1
Sharanya K M
  • 1,805
  • 4
  • 23
  • 44

1 Answers1

4

Possibly your project is set to use the wrong compiler. In your project settings, check that you are using Apple LLVM Compiler and not LLVM GCC.

See this image from a demo project to know where to look for:

enter image description here

sergio
  • 68,819
  • 11
  • 102
  • 123
  • Yes... i guess you are right.I used Apple LLVM compiler 4.1.. But it gives other ARC errors like ARC Restrictions error which means now that the file is ARC converted right? – Sharanya K M Dec 18 '12 at 08:32
  • Yes, it seems that the compiler is treating all of your files will be treated as ARC files. So, you should set the `-fobjc-arc` on a per file basis (i.e., only on XMPPPubSub). In the Build Phases -> Compile Sources, find out where that file is and then set its ARC option on only for that one. – sergio Dec 18 '12 at 08:38
  • That I have done. In the same file it shows other ARC restriction errors.. guess i'll figure it out.. Thanks :) – Sharanya K M Dec 18 '12 at 08:53