3

I downloaded the BlueTooth Low Energy (BLE) Heart Rate Example code (see: http://developer.apple.com/library/mac/#samplecode/HeartRateMonitor/Listings/ReadMe_txt.html if interested) and built it with XCode 4.6 on Mtn Lion MacBook Air. I get the following error: Documents/HeartRateMonitor/HeartRateMonitor/HeartRateMonitor-Prefix.pch:6:13: fatal error: 'Cocoa/Cocoa.h' file not found #import

I have tried various things such as getting rid of the precompiled header file, changing some settings, but nothing has worked. I'm new to the Apple world; I've done limited iOS stuff with XCode but no Mac programming. I have done some research and tried to follow the advice here for example: Compile, Build or Archive problems with Xcode 4 (and dependencies)

Is it OK to remove Prefix.pch file from the Xcode project?

Note that the original example states it is for XCode 4.2 or later.

Community
  • 1
  • 1
Dave
  • 6,585
  • 11
  • 51
  • 92

2 Answers2

4

I had this problem for the same exact project. Download the command line tools package from the apple dev site and your good to go.

https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-

Tommy Devoy
  • 13,279
  • 3
  • 46
  • 75
  • Thanks ttarules! That got be up and running. For those reviewing this, I was able to follow ttarules suggestion by going to XCode->Preferences->Downloads and installing the command line tools. I should have been doing this periodically anyhow (or set it to automatic downloads which is an option), but I am new to all this. Cool graphics on the heart rate monitor, huh? Thanks! – Dave Feb 05 '13 at 16:57
  • No problem anytime! And yeah totally! – Tommy Devoy Feb 05 '13 at 18:36
2

You need to add Cocoa.framework to your project - that's where Cocoa/Cocoa.h is found. See the Xcode documentation for details on how to do this with your particular version of Xcode. (BTW, once you do this, you shouldn't need to remove the .pch file.)

Bob Murphy
  • 5,554
  • 2
  • 28
  • 35
  • Thanks Bob. ttarules suggestion worked. I suspect downloading the command tools probably resulted in a download of the cocoa stuff. Cheers, Dave – Dave Feb 05 '13 at 17:45