Use gnustep to execute objective-C in Windows

Source: Internet
Author: User

The first thing to note is:

Although gnustep can be installed and used on Windows, it is mainly intended for Linux users rather than Windows users. If you have good Linux development experience, it is good to use gnustep. Gnustep is not powerful and only has the foundation library. Therefore, it is recommended that you spend more time on xcode!


Recently I learned objective-C, but I am very poor and can't afford xcode. Therefore, we plan to use the gnustep environment to compile and run the objective-C file. However, I found some online tutorials, which are old and copy each other. Some errors are reported. So I plan to write down the correct steps. If you have a better, simpler, and more correct method, please leave a message and I will learn and correct it. Thank you!

Go to http://www.gnustep.org/experience/windows.html to download the three sets of gnustep. Many articles are written to download two programs. In fact, GCC is now in the third file. The first two cannot be used.

These tools are gnustep msys system, gnustep core, and gnustep devel.

Download the package and install it. Click it all the way.

Then you can use it. Program> gnustep> shell. It can be used in 2 seconds after being turned on.

For example, edit the fraction. M file in the directory of drive f using text. The Code is as follows (the simplest obj-C program ):

 

# Import <Foundation/Foundation. h>

Int main (INT argc, char * argv []) {

NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc] init];

Nslog (@ "Hello world! ");

[Pool drain];

Return 0;

}

 

Input cd f:/in shell to switch to the directory of drive F, and then

Enter the command in shell: gcc-fconstant-string-class = nsconstantstring-C fraction. M-I/gnustep/system/library/Headers

This is a fraction. o file generated in the directory. (If this step is successfully completed, nothing is displayed in the command line. If yes, the display is incorrect)

Next, enter the command gcc-O fraction. O-L/gnustep/system/library/libraries/-lobjc-lgnustep-base.

If successful, a fraction.exe file is generated in the directory.

Finally, run the command./fraction.exe to view the output result. My result is: 19:30:33. 078 fraction [4824] Hello world!

Successful!

Source: http://blog.sina.com.cn/s/blog_61e24fd70100psrz.html

Related Article

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.