Http://www.61ic.com/Mobile/iPhone/201108/36504.html
--------------------------------------------------
Objective-C development-codeblocks instance operations
Author: blog ParkArticleSource: blog page views: 139 updated on:
In objective-C development, the content of codeblocks instance operations is described in this article. It mainly describes codeblocks-related content. Let's take a look at the details first.
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 []) {
NSAID utoreleasepool * Pool = [[NSAID utoreleasepool 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 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 ..., Select gnustep mingw compiler as the selected compiler, and select compiler Settings> other options.
-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.
Summary: The operations on the codeblocks instance in objective-C development are completed. I hope this article will help you!