Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa/Cocoa.h Not Found (Error)

I have done alot of research on this and only find people complaining about this error when there building a cocoa app on the iPhone.

I recently Grabbed the source for Colloquy for Mac and did everything it asked and ('Cocoa/Cocoa.h' File not found)

Here is the chunk of code that #import's everything.

#define ENABLE(FEATURE) (defined(ENABLE_##FEATURE) && ENABLE_##FEATURE)
#define SYSTEM(NAME) (defined(SYSTEM_##NAME) && SYSTEM_##NAME)

#define LIKELY(x) __builtin_expect((x) ? 1 : 0, 1)
#define UNLIKELY(x) __builtin_expect((x) ? 1 : 0, 0)

#define SYSTEM_MAC 1

#ifdef __OBJC__

#ifdef COMMAND_LINE_UTILITY
#import <Foundation/Foundation.h>
#else
#import <Cocoa/Cocoa.h>
#endif

#import "NSCharacterSetAdditions.h"
#import "NSDataAdditions.h"
#import "NSDictionaryAdditions.h"
#import "NSMethodSignatureAdditions.h"
#import "NSNotificationAdditions.h"
#import "NSObjectAdditions.h"
#import "NSScannerAdditions.h"
#import "NSStringAdditions.h"
#endif

#import "MVUtilities.h"

#if !defined(__unsafe_unretained)
#define objc_unretainedObject(object) (id)(object)
#endif

I have re-linked the frameworks so no need to ask me if I tried that. :)

Help will be much appreciated :D

like image 598
user705260 Avatar asked Jun 30 '11 06:06

user705260


Video Answer


1 Answers

Are you trying to build Colloquy for iOS? If you're not, skip the first section.


Your problem is that you're importing Cocoa/Cocoa.h. This is really two problems:

  1. Cocoa is the Mac development framework. It doesn't exist on iOS.
  2. iOS doesn't have umbrella frameworks. There is no CocoaTouch.framework as counterpart to Mac OS X's Cocoa.framework; for iOS, you import each framework's header specifically, and link against each framework specifically.

So, after you change the SDK from a Mac SDK to an iOS SDK, take out Cocoa.framework and the import of Cocoa.h, and add Foundation and UIKit (and any other frameworks you need) and import their headers.


In the case of Colloquy specifically

There are two projects in the Colloquy trunk: One for Mac OS X, the other for iOS. Make sure you're opening and trying to build the right project.

If you are intentionally trying to build the Mac project, and that's what's failing, make sure you have the necessary Mac SDK installed. Examine the project's build settings to see which one their project uses, then install it from your Xcode disk image. (If you installed Xcode via the MAS, I don't know what, if anything, you'll need to do.)

like image 133
Peter Hosey Avatar answered Dec 03 '22 09:12

Peter Hosey