Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error "Foundation.h: no such file found" while compiling Objective-C on WINDOWS

iam beginner in Objective-C, i tried to compile small Hello world program to start,iam using windows vista and the shell console, my code is:

 #import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    // insert code here...
    NSLog(@"Hello, World!");
    [pool drain];
    return 0;
}

the shell result show me the following error:

Foundation.h: no such file found

my command for compiling is:

gcc -o hello hello.m

i will appreciate any help, thanx in advance :)

like image 715
Malloc Avatar asked Mar 22 '26 16:03

Malloc


1 Answers

Foundation, as well as NSAutoreleasePool and NSLog are part of cocoa and cocoa-touch, Apples exclusive ObjC Frameworks. While you can use Objective-C, Foundation and all Foundation classes and functions are only available on Mac OS X and iOS.

You have three choices if you want to continue working with ObjC und the classes

  1. Write everything yourself (that will be hard as you say that you are a beginner and so you won't have the knowledge about the classes)
  2. Use something like GNUStep which tries to clone Foundation
  3. Switch to Mac OS X
like image 91
JustSid Avatar answered Mar 25 '26 04:03

JustSid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!