Establish an objective-C development environment in Windows

Source: Internet
Author: User

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.


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.