Objective-C headers code in Linux

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Objective-C headers code in Linux

cheer_xiao
Hi,
I've been using Clang for quite a while now and recently I'm trying
out Objective-C. While a simple "hello world"

#import <stdio.h>
int main() {
    printf("Hello world!\n");
    return 0;
}

compiles without complaints from clang, attempts to import
Objective-C-specific headers, like

#import <obj/Object.h>

results in an error like:

./Point.h:1:9: fatal error: 'objc/Object.h' file not found

(FYI, I'm following the Wikibooks tutorial on Objective-C:
http://en.wikibooks.org/wiki/Objective-C_Programming) It's clear that
I don't have the headers. But I have done a lot of Googles and got
stuck there - no hints on getting those Objective-C headers on Linux.
An solutions? BTW, Does there exist any alternative set of standard
library headers(other than the ones shipped with glibc) on Linux? If
there is, how do I have clang use them? I know that I'd better use the
more "native" glibc ones, but I'm just trying out.

I run Ubuntu 10.04 on my laptop. I have tried installing packages
gobjc-4.4 and libobjc2, hoping to get headers from it, but that
doesn't seem to work at all.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Objective-C headers code in Linux

David Chisnall-2
On 9 Jan 2011, at 11:47, cheer_xiao wrote:

> I run Ubuntu 10.04 on my laptop. I have tried installing packages
> gobjc-4.4 and libobjc2, hoping to get headers from it, but that
> doesn't seem to work at all.


That's because the Ubuntu packages for libobjc (which is really GCC libobjc 3) don't install the headers anywhere sensible.  They are installed, but in a stupid place.

The best way of compiling Objective-C code under Linux is to use GNUstep Make (should be in packages for Ubuntu), which handles all of this for you.

If you want to use the non-fragile ABI and declared properties then you will need to either use the GNUstep Objective-C runtime or link against a recent version of the GNUstep-base (Foundation) library.

David

--
This email complies with ISO 3103


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev