There are tons of great tutorials on the Internet that go into the details of the Objective-C. I put this together to help others coming from another language like C++, C# or Java get a ten minute overview of the basic syntax and have some compilable self-contained code examples. There is a brief comment at the top of each example indicating the "topic" that is demonstrated.
Below are instructions on how to quickly compile and run them.
GNUstep on Windows
- Download and install the MSYS, Core and Devel packages (in that order) from this page: http://gnustep.org/experience/Windows.html
- Click: Start | All Programs | GNUstep | shell
- Type: pwd (you'll see something like this: \home\xyz where xyz is your username)
- Then in windows explorer navigate to the path displayed above but stating at the drive you installed GNUstep on (something like: C:\GNUstep\home\xyz )
- Create a file named GNUmakefile with the following contents:
include $(GNUSTEP_MAKEFILES)/common.make TOOL_NAME = ex0 ex0_OBJC_FILES = ex0.m include $(GNUSTEP_MAKEFILES)/tool.make
- Create a file named ex1.m in C:\GNUstep\home\xyz and copy and paste the code from the ex1.m page into the file.
- At the GNUstep prompt type: make
- Then type ./obj/ex1 to run the sample
Xcode on the Mac
- Open Xcode
- Create a new xcode project.
- The new project window will give you the option of creating an Iphone app or Mac OS X app –we’re creating an Mac OSx app.
- Under “Mac OS X” your going to choose a “Command Line Tool” make sure you’re choose “Foundation” from the drop down.
- Create a name to Save your app (let’s assume you’ve chose the name app1).
- Open the .m file. In this case the file would be called app1.m.
- Delete everything on the page and copy/paste in one of the examples.
|
|