Build an objective-C development environment in Ubuntu 10.04
1. Introduction to objective-C
In the early 1980 s, Brad indeed invented objective-C in stepstone. Objective-C is a programming language based on the C language that adds object-oriented features and expands. Currently, it is mainly used in two openstep systems, Mac OS x and iPhone OS. Objective-C can be compiled and executed in any system running GCC, because GCC itself contains the objective-C compiler. [1]
2. Install the objective-C Development Environment
Many of my friends know that developing objective-C requires an Apple Mac machine (not an amazing startup !). It is unrealistic to buy an apple book (if the reader's financial ability permits it, let alone it .), What should I do? In ubuntu 10.04, you can use gnustep for objective-C development. Use the new installation package manager to install the software. After the installation is started, enter gnustep-devel, right-click and mark the installation, and the system will prompt you to install the relevant dependent software package (which is easy to manage). Then, select and click the application, to install.
3. Compile an instance
After the installation is complete, you must compile an instance [from Wikipedia] for verification. The example is as follows:
# Import <Foundation/Foundation. h>
Int main (INT argc, char * argv []) {
NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc] init];
Nslog (@ "Hello world! ");
[Pool drain];
Return 0;
}
Use the gedit or VI editor to edit the preceding content and save it as hello. M.
Open the terminal and enter the hello. m directory. Run the following command to edit the program:
$ GCC hello. m 'gnustep-config -- objc-flags '-lgnustep-base-O hello
Two files are generated in the current directory: Hello. d And hello (executable file ).
Run the executable program:
$ Hello
11:37:39. 917 Hello [5170] Hello world!
4. Objective-C learning materials
The Objective C Programming Language
Http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html
Objective C on Ubuntu
Http://www.excession.org.uk/blog/objective-c-on-ubuntu.html
Beginners Guide to objective-C Programming
Http://gnustep.made-it.com/BG-objc/
References
1. Wikipedia http://zh.wikipedia.org/zh-cn/Objective-C.
2. Build the object-C development environment in Ubuntu
Http://www.linuxidc.com/Linux/2010-08/28064.htm