Install and use GNUstep and Objective-C on Windows

Source: Internet
Author: User

Download GNUstep

In the GNUstep environment, you can use the MinGW tool in Windows. The MinGW is a portable version of the GNU compilation tool in Windows. Installing GNUstep includes installing MinGW and GNUstep, both of which can be downloaded here: http://www.gnustep.org/experience/Windows.html.

MinGW includes GNUstep System and GNUstep Core, which must be installed first.

Install MinGW and GNUstep

After downloading the required package, you can start installation. In the graphical Installation Wizard interface, we specify the installation directory as C: \ GNUstep.

Once MinGW is installed, you can install the GNUstep Core package.

Run GNUstep Shell

To start using Objective-C and GNUstep, start the GNUstep shell and run the Shell from the GNUstep in the Start Menu, as shown in:

Test after installation

This Shell environment is a minimal version of Linux or Unix environment. If you are not familiar with this environment, you can also use the editor you are familiar with in Windows.

When the Shell is started for the first time, it will enter the default home directory:

C: \ GNUstep \ home \ <username>

<Username> indicates the user name used to log on to Windows. Enter the following code to create a simple application:

01 # Import <Foundation/Foundation. h>
02  
03 Int main (int argc, const char * argv [])
04 {
05 NSAID utoreleasepool * pool = [[NSAID utoreleasepool alloc] init];
06  
07 NSLog (@ "hello world ");
08 [Pool drain];
09 Return 0;
10 }

Save the preceding code to the "hello. m" file in the main directory. You can use any editor to edit the file.

Run the following command to compile:

1 $ Gcc 'gnustep-config -- objc-flags '-L/gnustep/System/Library/Libraries hello. m-o hello-lgnustep-base
2 -Lobjc

If the compilation is successful, run the following command to execute the program:

1 ./Hello.exe

The program output information is as follows:

1 14:31:25. 721 hello [2200] hello world

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.