| 組件 | 功能 |
|---|---|
| gnustep-make | 構建系統(Makefile 模板、編譯標誌) |
| gnustep-base | Foundation 框架核心實現 |
| gnustep-gui | AppKit 圖形界面框架 |
| gnustep-back | 後端渲染(X11、Cairo、Win32 等) |
Windows 需額外安裝 MSYS2/MinGW/Cygwin 提供 POSIX 環境;Linux 直接包管理器安裝全套。
gnustep-tests # 運行自測套件,無錯誤即環境就緒
/* helloworld.m */
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
NSLog(@"hello world");
}
return 0;
}
gcc -o helloworld helloworld.m \
-fconstant-string-class=NSConstantString \
-I /GNUstep/System/Library/Headers/ \
-L /GNUstep/System/Library/Libraries/ \
-lobjc -lgnustep-base
-fconstant-string-class:指定 @"..." 字面量生成的類-I/-L:頭文件/庫搜索路徑-lobjc:Objective-C 運行時庫-lgnustep-base:Foundation 實現$ ./helloworld
2013-01-21 03:34:58.355 helloworld[22916] hello world
2024 年建議:
objc2 輕量運行時