Objective-C开发之CodeBlocks实例操作
2012-02-28 14:46
99 查看
http://www.61ic.com/Mobile/iPhone/201108/36504.html
--------------------------------------------------
Objective-C开发之CodeBlocks实例操作
作者:博客园 文章来源:博客园 点击数:139 更新时间:2011-8-5
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:GNUstepmingwbin
3. 创建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的内容改为CC
4. 设置编译选项
(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实例操作的内容介绍完了,希望本文对你有所帮助!
--------------------------------------------------
Objective-C开发之CodeBlocks实例操作
作者:博客园 文章来源:博客园 点击数:139 更新时间:2011-8-5
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:GNUstepmingwbin
3. 创建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的内容改为CC
4. 设置编译选项
(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实例操作的内容介绍完了,希望本文对你有所帮助!
相关文章推荐
- Objective-C开发之CodeBlocks实例操作
- windows下 Codeblocks 搭建 Objective-c 开发环境
- 使用code::blocks搭建objective-c的IDE开发环境,支持外部引用.h和.m文件
- 在Window环境下,使用CodeBlocks+GNUStep 配置Objective-C开发环境
- 使用code::blocks搭建objective-c的IDE开发环境 支持 @interface
- 使用code::blocks搭建objective-c的IDE开发环境 支持 @interface
- 在Window环境下,使用CodeBlocks+GNUStep 配置Objective-C开发环境
- windows下 Codeblocks 搭建 Objective-c 开发环境
- windows下 Codeblocks 搭建 Objective-c 开发环境
- windows下 Codeblocks 搭建 Objective-c 开发环境
- Windows下安装Code::Blocks 13.12进行C/C++开发
- iPhone应用开发之自动登陆实例操作
- Android游戏开发:实现手势操作切换图片的实例
- 新一代跨平台C++开发工具Code::Blocks简介
- fedora20下C/C++开发平台Code::Blocks使用笔记
- 程序开发入门工具之CodeBlocks
- 第三篇T语言实例开发,图色操作
- PDF.NET数据开发框架实体类操作实例(for PostgreSQL,并且解决自增问题)
- CodeBlocks 13.12设置winpcap开发环境