Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error with import <cocoa/cocoa.h>

I added class files from another project to my new iPhone Window for the first time. The class is a simple class that defines a polygon, and subclasses NSObject. As part of the standard template for an Objective C class, this class definition imports Cocoa.h

#import <Cocoa/Cocoa.h>

However, just by adding this class, I'm getting an error that

Cocoa/Cocoa.h:No such file or directory.

I don't understand this because the exact same line occurs in another class definition (the controller) within the same project.

like image 351
Craig Avatar asked Apr 13 '09 22:04

Craig


1 Answers

Subclasses of NSObject (at least on the iPhone) do not import the Cocoa.h header. Instead, they import Foundation.h:

#import <Foundation/Foundation.h>
like image 190
Craig Otis Avatar answered Sep 22 '22 22:09

Craig Otis