When you do not have a Mac or virtual machine, compile objective-C in windows.ProgramWhat about ??
Next, I will explain in detail how to compile objective-C language in windows.
1. Install the object-C Compiler
There are many objective-C compilers. This article introduces the use of gnustep.
Http://www.gnustep.org/experience/windows.html, you can download
GCC compiler:
Download these three files, for example, to the: D: \ OC Compiler
2. Install the integrated development environment of Object-C
Codeblocks-12.11mingw-setup.exe
3. Development Environment Configuration
Configure code blocks to build the objective-C development environment step by step. Codeblocks, yes
You can see the following picture:
Step 1: configure the Compiler
Go to settings-> compiler and debugger..., select the GNU gcc compiler, and press "copy"
Button, rename it as "gnustep mingw compiler", and save it.
Then go to the other options page and enter:-Fconstant-string-class = nsconstantstring-STD = c99
Step 2: Set linker stettings for the connector
Add two files to the link libraries ,.
They are under D: \ gnustep \ System \ library \ libraries:
Libgnustep-base.dll.a
Libobjc. dll.
Step 3: Specify the search directory search directories (you need to install gnustep in advance)
1) compiler (compiler) is set to D: \ OC compiler \ gnustep \ System \ library \ headers;
2) linker (connector) is set to D: \ OC compiler \ gnustep \ System \ library \ libraries;
Step 4: add support for objective-C file types
1) choose Settings> environment... and select files extension handling to add *. M.
2) Go to project> Project tree> edit file types & categories..., and add
Add *. m to the file type list.
3) choose Settings> editor..., select syntax highlighting, and click "filemasks,
Add *. m to the file type at the end of the dialog box.
4) Click the "keywords..." button (close to the filemasks... button) to add the following object-C keyword
In the edit keywords list ..
@ Interface @ implementation @ end @ Class @ selector @ Protocol @ public @ protected
@ Private ID bool yes no Sel nil null self
4.CodeTest
After the preceding development environment is configured, you can start code testing.
First, create a new project, select File> New> pr oject ..., A project type window appears. Select
Console application, and then follow the Project Creation instructions to create a mytest project, and
And enter the following code:
# Import <Foundation/Foundation. h> int main (INT argc, const char * argv []) {ngutoreleasepool * Pool = [[ngutoreleasepool alloc] init]; nslog (@ "% @", @ "Hello World"); [pool drain]; return 0 ;}
So far, all installation is complete.