http://blog.csdn.net/ldl22847/article/details/7482971
http://www.cnblogs.com/qingyuan/p/3524791.html
codeblock编译Object-C
Windows平台Objective-C编译环境搭建
安装codeblocks
安装GnuStep MSYS System(最小GNUlinux系统)、GnuStep core、GnuStep devel
配置codeblocks使得能够编译objective-c
http://www.codeblocks.org/downloads/binaries
The codeblocks-13.12mingw-setup.exe file includes the GCC compiler and GDB debugger from TDM-GCC (version 4.7.1, 32 bit). The codeblocks-13.12mingw-setup-TDM-GCC-481.exe file includes the TDM-GCC compiler, version 4.8.1, 32 bit. While v4.7.1 is rock-solid (we use it to compile C::B), v4.8.1 is provided for convenience, there are some known bugs with this version related to the compilation of Code::Blocks itself.
第一个不带编译器和调试器,第二个包含gcc编译器和TDM-GCC 4.7.1的gdb调试器,第三个包含4.8.1的TDM-GCC编译器。
这里,我们下载codeblocks-13.12mingw-setup.exe这个稳定版本。
这里我们只安装 GnuStep MSYS,GnuStep Core,GnuStep Devel
http://www.gnustep.org/experience/Windows.html
GnuStep是一个基于MinGw系统包含最基本的Gnu System on windows和MinGw库。
The GNUstep Windows installer is based on the MinGW system and consists of the basic MSYS and MinGW libraries, other library dependancies and the GNUstep Core packages (gnustep-make, gnustep-base, gnustep-gui, and gnustep-back.) The installer installs GNUstep onto most varieties of Windows (see below for tested installations) and sets up the computer to make it easy to run GNUstep applications. It was created with the NSIS installer.
http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-msys-system-0.30.0-setup.exe
GNUstep MSYS System 类似于cygwin的GnuStep最小系统
This installer is the first of two installers needed to get GNUstep running on Windows. The second installer is GNUstep Core (gnustep-core-X.X.X-setup.exe). You should install this installer first and then install gnustep-core. If you want to compile programs you also need to install gnustep-devel.
http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-core-0.34.0-setup.exe
http://ftpmain.gnustep.org/pub/gnustep/binaries/windows/gnustep-devel-1.4.0-setup.exe
开发必须
libtool, autoconf and pkg-config
GnuStep develop tool
a) Objective-C
Settings->Compiler->copy rename as objective-c
勾选调试 –g 和编译警告 –Wextra
增加编译参数Setting Other options
-fconstant-string-class=NSConstantString -std=c99
增加2个链接库
E:\GNUstep\GNUstep\System\Library\Libraries\libgnustep-base.dll.a
E:\GNUstep\GNUstep\System\Library\Libraries\libobjc.dll.a
指定搜索目录Searchdirectories(需要预先安装好GNUstep)
E:\GNUstep\GNUstep\System\Library\Headers
E:\GNUstep\GNUstep\System\Library\Libraries
添加Objective-C文件类型支持
Settings->Environment File extension handling
进入 Project->Projecttree->Edit file types & categories... ,在Sources, 下面添加*.m到文件类型列表中。如图:
进入Settings->Editor...,选择 Syntaxhighlighting,点击“Filemasks....”按钮,在弹出框尾部添加*.m 到文件类型。如图:
点击“Keywords...”按钮 (紧靠Filemasks...按钮) 添加下面Object-C的关键字到EditKeywords列表中。如图。
@interface @implementation @end @class @selector @protocol @public @protected @private id BOOL YES NO SEL nil NULL self |
点击“Keywords...”按钮 (紧靠Filemasks...按钮) 添加下面Object-C的关键字到EditKeywords列表中。如图。
@interface @implementation @end @class @selector @protocol @public @protected @private id BOOL YES NO SEL nil NULL self |
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
NSLog(@"%@",@"hello world-test");
NSString *name = @"hihi";
NSLog(@"123abc:%@",name);
NSLog(@"12nihao:%@",name);
printf("Hello world!\n");
[pool drain];
return 0;
}
注意:
1、 右键源文件rename为.m文件
2、 右键option,勾选compile file,link file
参考网址:
http://blog.csdn.net/ldl22847/article/details/7482971