当前位置:网站首页>CodeBlocks integrated Objective-C development

CodeBlocks integrated Objective-C development

2022-06-26 08:14:00 may_ he

GNUstep Windows Installer Provides Windows Under the platform Objective-C Simulation development environment for , There are four packages , among GNUstep System and GNUstep Core It's a must ,GNUstep Devel and Cairo Backend It's optional . Optional , One time safety , So as to avoid trouble in the future .

All four files are installed in C:GNUstep Next

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. by Code::Blocks Add a compiler

open Code::Blocks, Click menu Settings>Compiler and debugger>Global compiler settings
stay Selected compiler Click below the drop-down box Copy, Fill in the pop-up window with : GNUstep MinGW Compiler
after , Click on Toolchain executables tab , take Compiler’s installation directory Choose as C:GNUstepmingwbin


3. establish Objective-C engineering
Create a Console Of C engineering , take main.c Delete , newly build main.m file , The contents are as follows :
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[]) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSLog(@"Hello World!");
    [pool drain];
    return 0;
}

Right click main.m Click on property, choice Build tab , take Compile file And Link file All tick ,
choice Advanced, take Compiler variable Is changed to CC

4. Set compilation options

(1) Method 1
Right click the project to be created , choice Build options…,Selected compiler Compiler selection GNUstep MinGW Compiler, choice Compiler settings>Other options Fill in the -fconstant-string-class=NSConstantString 
choice Linker settings tab , Click on Add, Add the following two lines :
C:/GNUstep/GNUstep/System/Library/Libraries/libobjc.dll.a
C:/GNUstep/GNUstep/System/Library/Libraries/libgnustep-base.dll.a
choice Search directories>Compiler, Click on Add, Add the following :
C:/GNUstep/GNUstep/System/Library/Headers

(2) Method 2

Right click the project to be created , choice Build options…,Selected compiler Compiler selection GNUstep MinGW Compiler, choice Compiler settings>Other options Fill in the -fconstant-string-class=NSConstantString -IC:/GNUstep/GNUstep/System/Library/Headers  -LC:/GNUstep/GNUstep/System/Library/Libraries

choice Linker settings tab , stay Other linker options Input in -lobjc -lgnustep-base that will do


5. increase .m File type highlighting and editor Association
(1) Click on Settings>Editors>Syntax highlighting, choice Syntax highlighting for: C/C++, Click on Filemasks…, Add... In the pop-up window *.m, spot OK
choice Matlab, Click on Filemasks…, The inside *.m Delete
(2) Click on Settings>Environment>Files extension handling, Click on *.m, stay To open the file Choose from
Open it in a Code::Blocks editor that will do

from: http://www.jxva.com/?act=blog!article&articleId=208
原网站

版权声明
本文为[may_ he]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260809549032.html