Objective-C开发之CodeBlocks实例操作
2013-05-11
1412
简介:
点击打开原链接
Objective-C开发之CodeBlocks实例操作的内容是本文要介绍的内容,主要讲述了CodeBlocks相关的内容,先来看详细内容。1. 首先安装Objective-C编译器GNUstep Windows Installer提供了Windows平台下的Objective-C的模拟开发环境,一共有四个软件包,其中GNUstep System和GNUstep Co
点击打开原链接
Objective-C开发之CodeBlocks实例操作的内容是本文要介绍的内容,主要讲述了CodeBlocks相关的内容,先来看详细内容。1. 首先安装Objective-C编译器GNUstep Windows Installer提供了Windows平台下的Objective-C的模拟开发环境,一共有四个软件包,其中GNUstep System和GNUstep Core是必装的,GNUstep Devel和Cairo Backend是选装的。甭管必装选装,一次性全安上,免得以后麻烦。四个文件都安装到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. 为Code::Blocks添加编译器打开Code::Blocks,点击菜单Settings>Compiler and debugger>Global compiler settings在Selected compiler下拉框下面点击Copy, 在弹出窗口中填入: GNUstep MinGW Compiler之后,点击Toolchain executables选项卡,将Compiler’s installation directory选择为C:GNUstepmingwbin3. 创建Objective-C工程创建一个Console的C工程,将main.c删除,新建main.m文件,内容如下: #import <Foundation/Foundation.h> int main (int argc, const char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Hello World!"); [pool drain]; return 0; } 右击main.m点击property,选择Build选项卡,将Compile file与Link file都打上勾,选择Advanced,将Compiler variable的内容改为CC4. 设置编译选项(1)方法一右击将创建的工程,选择Build options…,Selected compiler编译器选择GNUstep MinGW Compiler, 选择Compiler settings>Other options中填入-fconstant-string-class=NSConstantString选择Linker settings选项卡,点击Add,增加如下两行内容: C:/GNUstep/GNUstep/System/Library/Libraries/libobjc.dll.a C:/GNUstep/GNUstep/System/Library/Libraries/libgnustep-base.dll.a 选择Search directories>Compiler,点击Add,增加如下内容: C:/GNUstep/GNUstep/System/Library/Headers (2)方法二右击将创建的工程,选择Build options…,Selected compiler编译器选择GNUstep MinGW Compiler, 选择Compiler settings>Other options中填入 -fconstant-string-class=NSConstantString -IC:/GNUstep/GNUstep/System/Library/Headers -LC:/GNUstep/GNUstep/System/Library/Libraries 选择Linker settings选项卡,在Other linker options中输入-lobjc -lgnustep-base即可5. 增加.m文件类型高亮及编辑器关联(1)点击Settings>Editors>Syntax highlighting, 选择Syntax highlighting for: C/C++,点击Filemasks…,在弹出窗口里面加入*.m,点OK选择Matlab,点击Filemasks…,将里面的*.m删除(2)点击Settings>Environment>Files extension handling,点击*.m,在To open the file中选择Open it in a Code::Blocks editor即可。小结:Objective-C开发之CodeBlocks实例操作的内容介绍完了,希望本文对你有所帮助!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。