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.
Downloading the GNUstep Packages
The GNUstep environment is made available on Windows using a toolkit called MinGW. MinGW is an abbreviation ofMinimal GNU for Windows and essentially provides a port of the GNU compiler collection, including Objective-C support, and a minimal shell
environment for Windows platforms. Installation of GNUstep involves installing both MinGW and GNUstep. Both of these packages are available from the GNUstep web site at
http://www.gnustep.org/experience/Windows.html.
The MinGW package is contained in the GNUstep System download and the GNUstep core is contained, unsurprisingly, in theGNUstep Core download. Both must be downloaded before proceeding with the installation.
[edit]Installing
MinGW and GNUstep on Windows
Once the required packages have been downloaded, locate the GNUstep System file and launch it to initiate the installation process. To complete the installation, simply follow the prompts in the installation wizard, using the default installation settings
unless you have specific requirements. In particular, should you decide to install the package in a location other than C:\GNUstep, you will need to adjust the instructions in the remainder of this chapter accordingly.
<style type="text/css">
<!--
-->
</style>

Once MinGW is installed, repeat the process for the GNUstep Core package.
[edit]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:
<style type="text/css">
<!--
-->
</style>

[edit]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) ashello.m. If you used Notepad, be sure to switch the
Save as Type option toAll 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
分享到:
相关推荐
总结来说,在Windows系统下搭建Objective-C开发环境虽然不像在Mac OS X上那样直接便捷,但通过使用GNUstep等工具,我们依然可以实现在Windows系统下的Objective-C开发。希望这份详细的指南能够帮助那些需要或希望在...
在压缩包`win7objectivec`中,可能包含了编译Objective-C在Windows 7上所需的一些资源、示例代码或者教程文档。如果你遇到任何问题,如编译错误或找不到库,查看这些资源通常能提供帮助。同时,确保你的系统满足所有...
17. 编译和构建环境:文中提到了多样的开发环境和构建系统,比如Linux/FreeBSD、GNUStep、XCode、Cygwin等,这些工具支持在不同的操作系统上构建和运行Objective-C程序。 18. Objective-C与C/C++的混合编程:...
在Windows平台上搭建Objective-C开发环境是一项相对复杂但可行的任务,主要依赖于GNUstep项目,它是一个开源实现的Objective-C环境,旨在提供与Apple的Mac OS X上的Cocoa类似的功能。以下是一个详细的步骤指南: 1....
它们会帮助用户在Windows系统上安装必要的库和开发工具,包括编译器、IDE、头文件和库文件,从而使得开发者能够使用Objective-C编写代码,并且利用Gnustep和Cairo的功能创建应用程序。 总的来说,Gnustep-Cairo-...
Objective-C是一种强大的面向对象编程语言,它在Apple的Mac OS X和iOS操作系统中广泛使用,尤其是在开发 Cocoa 和 Cocoa Touch 应用程序时。Gorm是一款专为Objective-C开发者设计的集成开发环境(IDE),旨在提供...
然而,通过使用GNUstep,一个开源的Objective-C框架,开发者可以在Windows上构建和运行Objective-C代码。下面将详细介绍如何在Windows下设置Objective-C的开发环境,并编写并运行一个简单的“Hello, World!”程序。 ...
它提供了一套类库和开发工具,可以在非Apple平台上使用Objective-C。下载并安装GNUStep的Windows版本。 4. **配置GNUStep**: 安装完成后,需要配置GNUStep的路径到PATH环境变量中,以便编译器能找到所需的库和...
- **设定环境**:在不同操作系统上配置Objective-C开发环境,如在Linux/FreeBSD上安装GNUStep,Mac OS X上安装Xcode,Windows上安装cygwin或mingw和GNUStep。 2. **Objective-C基础**: - **@interface**:定义类...
本文将详细介绍如何在Windows系统下使用Codeblocks IDE搭建Objective-C的开发环境。 #### 二、Objective-C的编译器安装 Objective-C的编译器有很多种,本文推荐使用GnuStep。GnuStep提供了Windows版本的gcc编译器...
本文旨在详细介绍如何在 Windows XP 操作系统中搭建一套基于 GNUstep 和 CodeBlocks 的 Objective-C 集成开发环境(IDE)。该环境对于希望在 Windows 平台上进行 Objective-C 应用程序开发的开发者来说非常实用。 #...
可以使用GNUstep在Windows XP上寫Objective-C程式,但是Objective-C已經加了很多新東西,而GNUstep裡的gcc並不提供,所以,这个是GNUstep,再加上新一代的編譯器架構Clang與LLVM(這也是Apple在新版Xcode裡預設使用...
在Windows环境下进行Objective-C开发可能不如在macOS上直观,但通过GNUStep提供的工具链,我们仍然可以实现跨平台的开发。熟悉这些工具和命令行操作对于提升开发效率至关重要。随着对Objective-C语法和GNUStep的理解...
随着移动互联网的发展,Objective-C作为iOS开发的重要语言之一,其应用范围虽然主要集中在Mac OS X和iOS平台,但有时候开发者可能需要在Windows平台上进行初步的学习或者简单的开发工作。本教程将详细介绍如何在...
在Windows操作系统上搭建Objective-C的集成开发环境(IDE)可能会比在macOS系统上稍微复杂一些,但通过一些工具和步骤,我们仍然可以构建一个功能完备的开发环境。本篇文章将详细介绍如何使用gnumstep和Code::Blocks这...
- **历史背景**:Objective-C 最初由 Brad Cox 和 Tom Love 在 1983 年开发,后来被苹果公司采纳并作为 Mac OS X 和 iOS 应用开发的主要语言之一。 - **应用领域**:Objective-C 主要用于开发 macOS 和 iOS 应用...
这为Windows平台上的Objective-C开发提供了支持。 #### 编译HelloWorld 编写第一个Objective-C程序通常是学习新语言的第一步。下面是如何使用Objective-C创建一个简单的“Hello, World!”程序: 1. **创建Classes...
对于想要在 Windows 上使用 Objective-C 的开发者来说,GNUStep 提供了一个可行的解决方案。 1. **安装 GNUStep**:访问官方提供的 Windows 安装页面,下载并安装以下四个文件: - gnustep-msys-system-xxx.exe -...
它继承了C语言的所有特性,并在此基础上增加了面向对象的功能和动态特性。 - **应用场景**: 主要用于开发苹果公司的操作系统上的应用程序,包括iOS和macOS。 #### 二、环境搭建 - **Linux/FreeBSD**: - 安装...