Difference between revisions of "Installing and using GNUstep and Objective-C on Windows"
m (Text replacement - "<google>ADSDAQBOX_FLOW</google>" to "<htmlet>adsdaqbox_flow</htmlet>") |
m (Text replacement - "<google>BUY_OBJC</google>" to "<htmlet>objc<htmlet>") |
||
Line 7: | Line 7: | ||
<hr> | <hr> | ||
− | < | + | <htmlet>objc<htmlet> |
In addition to using Objective-C on a Mac system, it is also possible to download and install the GNUstep and Objective-C environments for Microsoft's Windows family of operating systems. In this chapter we will explore the steps involved in downloading, installing and testing both Objective-C and GNUstep on Windows. | In addition to using Objective-C on a Mac system, it is also possible to download and install the GNUstep and Objective-C environments for Microsoft's Windows family of operating systems. In this chapter we will explore the steps involved in downloading, installing and testing both Objective-C and GNUstep on Windows. |
Revision as of 21:05, 1 February 2016
Previous | Table of Contents | Next |
Installing Xcode and Compiling Objective-C on Mac OS X | Installing and Using GNUstep and Objective-C on Linux |
Once MinGW is installed, repeat the process for the GNUstep Core package.
Running the GNUstep Shell
To begin using Objective-C and GNUstep, start the GNUstep shell by selecting Start -> All Programs -> GNUstep -> Shell. Once loaded, the shell will appear as follows: <google>IOSBOX</google>
Testing the Installation
The shell environment is a minimalist version of the shell environment you might find on a Linux or Unix system. If you are unfamiliar with such an environment then it is unlikely you will want to perform the code editing in this window. Fortunately, it is still possible to use your favorite editor on Windows.
When the shell is first started, it places you in the home directory for the GNUstep/MinGW environment. In terms of the Windows file system, and assuming you used the default installation location for MinGW and GNUstep, this is equates to:
C:\GNUstep\home\<username>
Where <username> is the name by which you logged into the Windows system. To create a simple application, open a suitable editor (Notepad will do) and enter the following code:
#import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog (@"hello world"); [pool drain]; return 0; }
Once the code has been entered, save the file in your GNUstep home directory (as outlined above) as hello.m. If you used Notepad, be sure to switch the Save as Type option to All Files so that the file is not given a .txt file name extension.
Once the code has been written and saved, it can be compiled from the GNUstep shell window by entering the following command:
$ gcc `gnustep-config --objc-flags` -L /GNUstep/System/Library/Libraries hello.m -o hello -lgnustep-base -lobjc
Assuming a successful compilation, run the application as follows:
./hello.exe
When executed, the test program should produce output similar to:
2009-09-24 14:31:25.721 hello[2200] hello world
<google>BUY_OBJC_BOTTOM</google>
Previous | Table of Contents | Next |
Installing Xcode and Compiling Objective-C on Mac OS X | Installing and Using GNUstep and Objective-C on Linux |