CodeBlocks integrated Objective-C

Source: Internet
Author: User
Tags cairo
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.exehttp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-core-0.25.0-setup.exehttp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-devel-1.1.1-setup.exehttp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-cairo-0.22.1-setup.exe

2. Add a compiler for Code: Blocks
Open Code: Blocks, click 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 Toolchain executables tab and select "C: GNUstepmingwbin" as the "Compiler's installation directory ".

3. Create an Objective-C ProjectCreate a C Project for the Console and set main. c. Delete and create main. m file with the following content: # import <Foundation/Foundation. h> int main (int argc, const char * argv []) {ngutoreleasepool * pool = [[ngutoreleasepool alloc] init]; NSLog (@ "Hello World! "); [Pool drain]; return 0 ;}
Right-click main. m and click the property tab, select the Build tab, tick both 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 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 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 ..., 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, select open it in a Code: Blocks editor in To Open the file.
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.