Codeblocks integrated objective-C Development

Source: Internet
Author: User
Tags cairo
From: http://kingj.iteye.com/blog/1558869 <1>

Objective-C is the programming language of Apple software. It is much easier to have an integrated development environment (IDE) for machine learning and debugging. There are three ways to build an integrated development environment for objective-C:

<! -- [If! Supportlists] -->1)<! -- [Endif] --> use the apple platform and integrate the development environment with xcode. However, if you do not have an apple platform and want to learn objective-C in a Windows environment, you can use either of the following methods:

<! -- [If! Supportlists] -->2)<! -- [Endif] --> An apple virtual machine is set up in a Windows environment, but this requires a high performance for PCs. Not all PCs can, moreover, the virtual machine runs slowly;

<! -- [If! Supportlists] -->3)<! -- [Endif] --> use the codeblocks IDE development environment to configure it and build an integrated development environment that supports object-C compilation, debugging, and running. This method has almost no requirements on the Performance of personal computers and can be quickly built. This method is described in this article.

 

 

 

1. Install the object-C Compiler

There are many objective-C compilers. This article describes how to use gnustep at http://www.gnustep.org/experience/windows.html. Here we can download the gcccompiler for Windows:

 

Go to the download page, download the above three software packages, and install them, for example, to D: \ gnustep. The functions of these three software packages can be queried online.

 

2,Install the integrated development environment of Object-C

We chose codeblocks ide as the integrated development environment for objective-C, which is http: // www.Codeblocks. Org /.

 

3. Development Environment Configuration

Configure code blocks to build the objective-C development environment step by step. Codeblocks:

 

 

 

 

Step 1: configure the Compiler

EnterSettings-> compiler and debugger..., SelectGNU gcc CompilerCompiler, press the "copy" button and rename it"Gnustep mingw Compiler"And save.

EnterOther optionsPaging, input:

-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(Gnustep needs to be installed in advance)

 

<! -- [If! Supportlists] -->1)<! -- [Endif] -->Compiler(Compiler) set to D: \ gnustep \ System \ library \ headers;


 2) linker(Connector) is set to D: \ gnustep \ System \ library \ libraries;


 Step 4: add support for objective-C file types

<! -- [If! Supportlists] -->1)<! -- [Endif] --> enterSettings-> environment..., SelectFiles extension handlingAdd*. M.


 2)EnterProject-> Project tree-> edit file types & categories..., InSources, Add*. MTo the file type list.


 3)Go to settings-> editor..., select syntax highlighting, click "filemasks...", and add *. m to the file type at the end of the pop-up box.


 4)Click the "keywords..." button (close to the filemasks... button) to add the following object-C keywordEdit keywords..

@ Interface @ implementation @ end @ Class @ selector @ Protocol @ public @ protected @ Private ID bool yes no Sel nil null self @ Protocol

 


 

 

 

 

<! -- [If! Supportlists] -->4.<! -- [Endif] -->Code Testing

After the preceding development environment is configured, you can start code testing.

First, create a project and selectFile-> New-> project ...,A project type window appears. Select console application and follow the Project Creation instructions to create a mytest project, rename the main. c file to main. m, and enter the following code:

# Import <Foundation/Foundation. h>

Int main (INT argc, const char * argv [])

{

NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc] init];

Nslog (@ "% @", @ "Hello World ");

[Pool drain];

Return 0;

}


Then compile and run:Buid-> run...If the following window appears, congratulations, you have successfully set up the integrated development environment for objective-C in windows.

 

Then compile and run:Buid-> run...If the following window appears, congratulations, you have successfully set up the integrated development environment for objective-C in windows.


If compilation passes and runs smoothly, congratulations! The Windows development environment of Object-C has been configured. If you want to understand and run the cocoa framework

You also need to configure codeblocks in the next step.

 

Statement: From: http://www.jxva.com/blog/201112/208.html<2>
1. first, install the objective-C compiler gnustep Windows installer to provide a simulated development environment for objective-C on the Windows platform. There are four software packages in total, among which gnustep system and gnustep core are required, gnustep devel and Cairo backend are optional. Render manager must be installed and installed at one time, so as to avoid future troubles. Install all four files in C: gnustep.

Http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-msys-system-0.25.1-setup.exe

Http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-core-0.25.0-setup.exe

Http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-devel-1.1.1-setup.exe

Http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-cairo-0.22.1-setup.exe

2. to add a compiler for code: blocks, open code: blocks. click Settings> compiler and debugger> global compiler settings. in the selected compiler drop-down box, click Copy. In the displayed window, enter: after gnustep mingw compiler, click the toolchain executables tab and select Compiler's installation directory as C: gnustepmingwbin3. create an objective-C Project and create a C Project for the console. c. Delete and create main. M file with the following content: # import <Foundation/Foundation. h> int main (INT argc, const char * argv []) {ngutoreleasepool * Pool = [[NSAID utoreleasepool alloc] init]; nslog (@ "Hello world! "); [Pool drain]; return 0;} Right-click main. M click property, select the build tab, tick both compile file and link file, select advanced, and change the content of compiler variable to cc4. set compilation option (1) method 1 right-click the project to be created, select build OPTIONS ..., Selected compiler select gnustep mingw compiler, select compiler Settings> other options, fill in-fconstant-string-class = nsconstantstring, select the linker settings tab, and click Add to add the following two lines: C: /gnustep/system/library/libraries/libobjc. DLL. AC:/gnustep/system/library/libraries/libgnustep-base.dll.a select search directories> compiler, click Add, add the following content: C: /gnustep/system/library/headers (2) method 2 right-click the project to be created and select build OPTIONS ..., Selected compiler select gnustep mingw compiler, select compiler Settings> other options and enter-fconstant-string-class = nsconstantstring-ic:/gnustep/system/library/headers-LC: /gnustep/system/library/libraries select the linker settings tab and enter-lobjc-lgnustep-base in other Linker Options. add. M file type highlighting and editor Association (1) click Settings> editors> syntax highlighting, select syntax highlighting for: C/C ++, click filemasks ..., In the pop-up window, add *. M, click OK, select MATLAB, and click filemasks ..., Set *. M deletion (2) click Settings> environment> files extension handling, and click *. m, in to open the file select open it in a code: blocks editor for more reference: http://wiki.codeblocks.org/index.php? The title = Installing_Objective-C_Compiler
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.