2

I have this line of code:

GetVolParmsInfoBuffer volumeParms;
HParamBlockRec pb;

And I included this header:

#include </System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h>

But still the compiler throws the error that HParamBlockRec is unknown type.

In a other project with the same files everything works fine, even without including the Files.h header.
Is there anything I'm missing?

Update I was able to fix the error by setting the architecture to 32-Bit.

But now I'm getting this build error:

error: -fobjc-arc is not supported with fragile abi

I searched a little and it's been sait that switching to the LLVM GGC 4.2 compiler would help, but it doesn't.

Right now my build settings are:

  • 32-bit Intel
  • Mac OSX 10.7 SDK
  • Build active architecture only Yes
  • Mach-O Type is set to Dynamic Library

I'm very unfimiliar with coding in XCode. So it would be great if you could help me out here.

Johannes Klauß
  • 10,676
  • 16
  • 68
  • 122

2 Answers2

4

Unfortunately for you, ARC is simply not available on 32-bit OS X. Apparently Apple has decided that all new development should have moved to x86-64 by now, so all the sweet new Objective-C 2.0 features — not just ARC, but also -fobjc-nonfragile-abi, container literals, object subscripting, default synthesis of properties... — are implemented only for 64-bit OS X (and of course for 32-bit iOS).

So, if you're trying to produce a fat binary containing code for both 32- and 64-bit versions of OS X, you'll have to limit yourself to Objective-C 1.0 features and/or hack up your codebase with #ifdefs. This isn't fair, but it's true. Sorry.

Community
  • 1
  • 1
Quuxplusone
  • 23,928
  • 8
  • 94
  • 159
2

You shouldn't include individual headers from a framework. Use the umbrella header instead:

#include <Carbon/Carbon.h>

Also, per the documentation HParamBlockRec is not available in 64-bit. You will need to find a modern substitute for the parameter block-based function you’re using.

As for the -fobjc-arc warning, make sure you have the Objective-C Automatic Reference Counting ($CLANG_ENABLE_OBJC_ARC) build setting set to No (NO).

gcbrueckmann
  • 2,413
  • 18
  • 10
  • Then you should include more details in your question (base SDK, deployment target, Xcode version, OS X version you’re building on). I’ve also added a compatibility note to my answer. – gcbrueckmann Jul 05 '12 at 14:24