Setup OC integrated development environment under WINDOWS

Source: Internet
Author: User

Objective-c is an Apple software programming language that wants to learn, debug, and have an integrated development environment (IDE) handy. There are three types of methods for building OBJECTIVE-C's integrated development environment:

1) using the Apple platform, the integrated development environment uses Xcode. But if you don't have an apple platform and want to learn objective-c in a Windows environment, there are two ways to do this:

2) set up an Apple virtual machine in the Windows environment, but this is a high performance requirement for the PC, not all PCs can, and the virtual machine is running slower;

3) adopt the Codeblocks IDE development environment, configure it, build an integrated development environment that supports OBJECT-C compiling, debugging and running. This method is almost not required for the performance of personal computers and can be built quickly, this article describes this method.

 

1. Install object-c compiler

Objective-c has a lot of compilers, this article describes the use of GNUstep, the URL is http://www.gnustep.org/experience/Windows.html, where you can download the Windows version of the GCC compiler:

Go to the download page and download the above 3 packages for installation, such as installing to D:\GNUstep. About the role of these 3 packages, can be queried online, no longer repeat.

 

2, installation of OBJECT-C integrated development environment

We chose to use the Codeblocks IDE as the integrated development environment for OBJECTIVE-C, which is:http://www. Codeblocks. org/.

 

3. Development environment Configuration

Through the configuration of code blocks, step by step to complete the construction of the OBJECTIVE-C development environment. Codeblocks, you can see such a picture:

First Step: Configure the compiler

Enter Settings->compiler anddebugger..., select the GNU GCC Compiler compiler, press the "Copy" button, and rename "GNUstep MinGW Compiler" and save.

 

then enter Other Options Paging, entry :

-fconstant-string-class=nsconstantstring-std=c99

 

Step Two: Connector settings linkerstettings

Add two files to the connection library (link Libraries).

They are below the D:\GNUstep\GNUstep\System\Library\Libraries:

Libgnustep-base.dll.a

Libobjc.dll.a

 

 

Step Three: Specify Search directory Searchdirectories(requires pre-installed GNUstep)

 

1) Compiler(compiler) set to D:\GNUstep\GNUstep\System\Library\Headers;

 

 

2) Linker(connector) set to D:\GNUstep\GNUstep\System\Library\Libraries;

 

Fourth Step: Add objective-c file type support

1) enter settings->environment ... , select Files Extension Handling Add *.M .

2) enter project->projecttree->edit file Types & Categories ... , in Sources, add *.m below to the list of file types.

3) enter settings->editor ... , select Syntaxhighlighting, click "filemasks ...." button to add *.m to the file type at the end of the popup box .

 

 

4) Click "Keywords..." Button ( close to filemasks ... Button ) to add the following object-c keyword to the editkeywords list:

@interface @implementation @end @class @selector @protocol @public @protected ID BOOL YES NO SEL Nil NULL Self

 

4. Code Testing

Once the above development environment configuration is complete, you can begin the code test.

First, create a new project, select file->new->project ..., a project type window will appear, select Console application, then follow the construction guidelines to establish a mytest project, and rename the Main.c file to MAIN.M, enter the following code:

#Import <Foundation/Foundation.h>

int main (int argc, const char *argv[])

{

nsautoreleasepool *pool =[[nsautoreleasepool alloc] init];

NSLog (@ "%@", @ "HelloWorld");

[Pool drain];

return 0;

}

 

Then start the compile run:buid–> Run ... If the following window appears, congratulations, you have successfully built the OBJECTIVE-C integrated development environment under Windows.

Setup OC integrated development environment under WINDOWS

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.