Windows in the fabric Objective C development environment

Source: Internet
Author: User

For recent plans to develop some apps for iphone, IPod Touch and ipad, so. Need to start learning objective C (Apple launches a C language-like development language). Because of the limitations of Apple's self-closing industrial chain development model (from chips, machines, development languages, end products, and services), to develop applications for products such as Apple's iphone, it is necessary to use the Mac machine, which is developed using the Objective C language on the Xcode IDE.

Mac machines are needless to say. That's a lot more expensive than a PC machine (of course the price is very high), so, to learn cheap way objective C must be able to build a objective C development environment on Windows. All right. Don't talk nonsense.


http://www.gnustep.org/experience/Windows.html
Build Objective C development environment under Windows, need to download to GNUstep official site, four packages: GNUstep MSYS System, GNUstep Core, GNUstep Devel, Cairo backend. Of these, the first two packages are required to be installed, and the third package is to install some development tools. For example: GCC, g++, etc., so the hypothesis is to learn objective C words. This package is also required to be installed. The fourth package is the installation of glib and other libraries, this package installation is not installed according to the details of the situation.



As for what GNUstep is and what it does, here's a simple introduction: GNUstep is an API and tool that provides similar cocoa (Apple OS Development framework), now supports Gnu/linux and Gnu/hurd, Solaris, NetBSD, OpenBSD, FreeBSD, Darwin and Windows, free to use.

This project enables objective C to be developed and implemented on most popular platforms.

For a specific introduction, start with the official site of GNUstep.

Anyway After downloading the above package, click Install to be able to. And then. You need to confirm that the installation was successful and that the objective C code could be compiled successfully.


In the "Start" menu under "All Programs" can find "GNUstep", "shell", will be out of the console form, you can try some Linux commands (Ls,cd,mkdir, etc.).

Write a objective C code to compile and perform the test. Here is the classic "Hello World" to illustrate:

#import <foundation/foundation.h>int Main (int argc, const char *argv[]) {    NSAutoreleasePool *pool=[[ NSAutoreleasePool alloc] init];    NSLog (@ "Hello world!");    [Pool drain];    return 0;}
Use a text editor (Editplus,ue, etc.) in a Windows environment to write the above code, and save it to GNUstep the installation folderHome/home Under the name of HELLOWORLD.M. Under the console form command line in GNUstep.

1, Cd/home

2, Gcc-o HelloWorld helloworld.m-i/gnustep/system/library/headers-fconstant-string-class=nsconstantstring-l/ Gnustep/system/library/libraries-lobjc-lgnustep-base

3, the implementation of Helloworld.exe

Note: Some of the parameters in the second step, it should be very familiar to assume that if you are familiar with Linux/unix C + + compile. -I represents the path to the header file lookup, and-L represents the library file lookup path. -L indicates a library file that needs to be linked. However,-fconstant-string-class=nsconstantstring may be unfamiliar with this parameter, which is mainly the class used to specify the constant string.

improved: because in the GNUstep form can not copy, paste, manual typing easy error, so, can write a shell script. Named test.sh, the contents are as follows:

Gcc-o "$" "-i/gnustep/system/library/headers-fconstant-string-class=nsconstantstring-l/gnustep/system/" Library/libraries-lobjc-lgnustep-base

And then the same as above, under the console form command line in GNUstep

1, Cd/home

2, SH test.sh helloworld helloworld.m

3, the implementation of Helloworld.exe

Description: The $ and $ $ in test.sh respectively represent the 1th and 2nd parameters that were obtained in the run test.sh simultaneous. Then through the SH test.sh helloworld helloworld.m is to run the test.sh script and pass in two parameters, the purpose of the use of the argument is to make this test.sh a compiled template, so that each time only to pass a different number of parameters to compile and run.


Helloworld.exe compiled and executed successfully, stating that Windows Objective C builds a good development environment, which can be started by learning, inexpensive way to start objective C

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Windows in the fabric Objective C development environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.