Establish an objective-C development environment in Windows

Source: Internet
Author: User

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, which is a program called Objective c.


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.

 

Source: http://blog.csdn.net/wxw45601/article/details/7484056

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.