Win10 structures using CodeBlocks Objective-C Development Environment (a)

To learn ios development, but do not have a Mac, if the learning objective-c program in windows platform, you need to install OC development environment,

After online access to all relevant information, after many failures, and finally installed and tested successfully, especially the installation process and experience sharing;

(Hemp eggs, a lot of online tutorials, many of which are directly reproduced, mangled, and not try, so I really spent a boss Jin (;'д `) ゞ;

In order to facilitate the current OC brothers want to learn programming in Windows, is now sorted out the whole process in order to facilitate. o (* ¯3¯) o)

First, install CodeBlocks IDE cross-platform development environment

Software installation address , please click to download and install.

 Recommended to install codeblocks-17.12mingw-setup.exe version, the package integrates gcc / gcc + compiler;

Second, the installation gnustep compiler


Note: Refer to page description, must be installed in the order of 1, 2, it is recommended to install the "Run as administrator";

3 software is installed by default in the C: \ GNUstep; recommended by the default action to install, easy to configure back links.

Third, configure CodeBlocks development environment

1, open interface is as follows:

 2, configuring the compilers

Click into the Settings-> Compiler ... , selected by default GNU GCC Compiler Compiler, click Copy, copy a compiler configuration file,

(Click Copy will automatically pop up the Rename dialog box), copy the configuration file is renamed GUNstep MinGW Compiler, click on "set as default",

As OC default compiler configuration file, as shown:

Compiler settings

Click Setting Compiler -> Other Compiler Options, in the space below entry:

-fconstant-string-class=NSConstantString -std=c99

链接器设置

点击linker setting,依次添加两个文件:

C:\GNUstep\GNUstep\System\Library\Libraries\libobjc.dll.a

C:\GNUstep\GNUstep\System\Library\Libraries\libgnustep-base.dll.a

具体文件路径根据各位安装的硬盘位置,该出路径为默认安装路径;

搜索目录

点击search directories,添加搜索目录:

C:\GNUstep\GNUstep\System\Library\Headers

添加文件类型和关键字支持(主要用于OC代码指令进行着色,便于自动书写和查阅)

依次点击setting--editor-syntax highlighting-filemasks或keywords

在filemasks中文件扩展名中增加 :*.m,

在keywords中增加:@interface @implementation @end  @class @selector @protocol @public @protected @private id BOOL YES NO SEL nil  NULL self

删除matlab中的文件类型:*.m,

在objective c中增加:*.m,

环境设置

依次点击 setting--environment--files extension handling--new,增加 *.m 类型

 

至此 开发环境已经搭建成功

ヾ(◍°∇°◍)ノ゙,写文章好累啊,以前也没发过博文;不知道发布出来的效果如何,能不能看清图片内容(キ`゚Д゚´)!!

四、新建工程,运行代码进行测试

依次点击 new--project--console application-选择 c --工程名称为test(工程名称和文件夹地址,自己随便取),然后一直点击next即可,

最后一个界面时,请确认,默认编辑器是否是GNUstep,要与前面安装的编译器一致,否则运行时会提示“缺少编译器”。

新建成功后会出现以下2个文件,源文件中有main.c和main.cpp;双击main.c左边代码视图中会出现C语言“hello world”的代码。

而OC对应的工程文件为.m文件,所以我们要删除main.c并新建main.m文件;在main.c文件上右键,选择“remove file from project”;

添加*.m文件类型,依次点击test(新建的工程名称,右键点击)--project tree--edit file types & category..增加 *.m;---最后点击ok。

该步操作如下图:

然后建立main.m文件

在test上右键,选择add file,在弹出对话框中(会自动打开大家建立的工程文件夹)新建文本文件,并重命名为main.m(需更改文本文件的扩展名);

至此,工程文件已经建好;但此时会发现main.m文件为灰色,且无法点击,此时需右键点击main.m文件,在option选项中勾选 compile file和 link file选项。

本文待续。。。。。

本文为博主原创,详细记录每步安装及设置过程,请尊重作者成果,如需转载请指明,文件出处“https://www.cnblogs.com/clsmile/p/11672403.html”。

Guess you like

Origin www.cnblogs.com/clsmile/p/11672403.html