Codeblocks integrates objective-C to learn objective-C in Windows

Source: Internet
Author: User
Tags cairo

Codeblocks integrated objective-C Development

1. First install the objective-C Compiler

Gnustep Windows Installer provides a simulated development environment for objective-C on the Windows platform. There are four software packages, including gnustep system and gnustep core, 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. Add a compiler for code: Blocks

Open code: blocks, and choose Settings> compiler and debugger> global compiler settings.
Click copy in the selected compiler drop-down box and enter gnustep mingw compiler in the pop-up window.
Click the executables Tab Of The toolchain and select "C: gnustepmingwbin" as the "Compiler's installation directory ".

3. Create an objective-C Project
Create a console C Project, Delete Main. C, and create a new main. M file. The content is as follows:

#import <Foundation/Foundation.h>int main (int argc, const char *argv[]) {    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];    NSLog(@"Hello World!");    [pool drain];    return 0;}

Right-click main. M and click the property tab, select the build tab, and check both the compile file and link file,

Select advanced and change the content of compiler variable to CC.

4. Set compilation options

(1) method 1

Right-click the project to be created, and select build OPTIONS ..., Selected compiler select gnustep mingw compiler, select compiler Settings> other options and 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.

C:/gnustep/system/library/libraries/libgnustep-base.dll.a

Select search directories> compiler and click Add to 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.

5. Add. M file type highlighting and editor Association

(1) click Settings> editors> syntax highlighting, select syntax highlighting for: C/C ++, and click filemasks ..., Add *. m to the pop-up window and click OK.

Select MATLAB, click filemasks ..., Delete *. m

(2) click Settings> environment> files extension handling, click *. m, and select

Open it in a code: blocks Editor

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.