codeblock編譯Object-C

 

http://blog.csdn.net/ldl22847/article/details/7482971html

http://www.cnblogs.com/qingyuan/p/3524791.htmllinux

codeblock編譯Object-Cobjective-c

Windows平臺Objective-C編譯環境搭建windows

安裝codeblocksapp

安裝GnuStep MSYS System(最小GNUlinux系統)、GnuStep core、GnuStep develide

配置codeblocks使得可以編譯objective-cui

1.   Codeblocks

http://www.codeblocks.org/downloads/binariesthis

                       

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.spa

第一個不帶編譯器和調試器,第二個包含gcc編譯器和TDM-GCC 4.7.1的gdb調試器,第三個包含4.8.1的TDM-GCC編譯器。.net

這裏,咱們下載codeblocks-13.12mingw-setup.exe這個穩定版本。

2.   GnuStep套件安裝

這裏咱們只安裝 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         相似於cygwinGnuStep最小系統

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

3.   codeblocks配置

配置編譯器

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

4.    建立工程示例

 

 

 

 

 

#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;

}

注意:            

一、  右鍵源文件rename爲.m文件

二、  右鍵option,勾選compile file,link file

參考網址:

http://blog.csdn.net/ldl22847/article/details/7482971

相關文章
相關標籤/搜索