Magwin Method
 
1. Install the Compiler
 
There are many objective-C compilers. llvm is developed from GCC and is mainly used on Apple's platform. GNU can use gnustep.
C program.
Go to the download page and download the above three software packages for installation, for example, to D: \ gnustep,
 
2. Install the codeblocks IDE environment
 
: Http: // www.Codeblocks. Org/
 
3. Configure the Compiler
 
After codeblocks is installed, goSettings-> compiler and debugger..., SelectGNU gcc compiler, copy againName it "gnustep mingw compiler"
 
 
Compile other options:-Fconstant-string-class = nsconstantstring-STD = c99
 
 
Specify the search directory at the same time:
The compiler's search directory is D: \ gnustep \ System \ library \ headers.
Set the linker search directory to D: \ gnustep \ System \ library \ libraries, and set the linker parameter:-lobjc-lgnustep-Base
Alternatively, you can add two file libgnustep-base.dll.a, libobjc. dll. A, under D: \ gnustep \ System \ library \ libraries, to the linker Option
 
 
 
Set the search directory for compilers and connectors
 
 
4. Configuration syntax, file type, and keywords
 
Support for adding file types
 
1) EnterSettings-> environment...
 
2) SelectFiles extension handlingAdd*. M
 
3) EnterProject-> Project tree-> edit file types & categories...
 
4) InSources, Add*. MTo the file type list.
 
 
Add syntax highlighting support
 
1) EnterSettings-> editor...
 
2) SelectSyntax highlightingEnterFilemasks.... Add*. MTo the file type list.
 
3) EnterKeywords...(CloseFilemasks...) Add the following keywords to the list.
 
 
  
   
   | @ Interface @ implementation @ end @ Class @ selector @ Protocol @ public @ protected @ Private ID bool yes no Sel nil null self |  
  
 
  
 
 
 
 Add *. m extension to syntax highlighting
 
 
 
5. Code Testing
 
Create a new project, change main. C to main. m, 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;} 
 
The compilation and running effect is as follows:
 
 
 
  
   
   17:33:49. 711 objc1 [6080] Hello World Process returned 0 (0x0) execution time: 0.220 s Press any key to continue.  |