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