1.å¦ä½å¨Windowsä¸ç¼è¯Objective-C
å¦ä½å¨Windowsä¸ç¼è¯Objective-C
1ãå®è£ GNUstep
GNUstep Windows Installeræä¾äºWindowså¹³å°ä¸çObject-Cç模æå¼åç¯å¢ï¼ä¸å ±æå个软件å ï¼å ¶ä¸GNUstep SystemåGNUstep Coreæ¯å¿ è£ çï¼GNUstep DevelåCairo Backendæ¯éè£ çãåªå®è£ å两个就å¤äºã
2ãç¼åObjective-C代ç
å®è£ å®æåï¼å¨å¼å§èåéçGNUstepé项éæ§è¡shellï¼å°±è½æå¼å½ä»¤è¡ãç´æ¥å¨Windowséè¿å ¥C:/GNUstep/home/Administratorï¼æçæ¯Administratorï¼å¯è½æçä¸ä¸æ ·ï¼ç®å½ï¼å¨è¿éç¨ä½ å欢çå·¥å ·ï¼ç°å¨UltraEditåNotepad++ç¼è¾å¨å¥½åå¯ä»¥ä»£ç é«äº®ï¼ç¼åObject-Cç¨åºã
å¦ï¼HelloWorld.m
#import <Foundation/Foundation.h>
int main (int argc,layoff源码 const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello World!");
[pool drain];
return 0;
}
3ãé ç½®ç¯å¢åé
è¿ä¸æ¥å¾éè¦ãGNUstep.shæ¯ç¨æ¥è®¾ç½®GNUstepå¼åç¯å¢åéçï¼å¦æ没ææ§è¡ï¼å°±ä¼æå¾å¤å¤´æ件ï¼åºæ件ï¼å½ä»¤æ¾ä¸å°
å¨ä¸ä¸ªç®å½éå好äºæºä»£ç 以åï¼ç¼åä¸ä¸ªmakeé ç½®æ件ï¼ååå¿ é¡»å«GNUmakefileï¼å 容æ¯
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME=Test
Test_OBJC_FILES=HelloWorld.m
include $(GNUSTEP_MAKEFILES)/tool.make
å¯ä»¥ä¿®æ¹ä¸é¢çé»ä½é¨å
ç¶åå°±æ¯
make
å½ä»¤è¿è¡æåå°±å¯ä»¥çå°æ°å¢äºä¸ä¸ªobjç®å½ï¼éé¢å°±æä½ è¦çå¯æ§è¡æ件å.oæ件ã
OK æå®äºã