#眉標=Open Source #副標=Windows 上的自由軟體 #大標=MinGW 程式環境:相關程式工具的使用與Objective C的介紹 #作者=文/黃昭龍 #========= #程式1 – mygdbtest.c 1: #include 2: 3: int main(int argc,char **argv) 4: { 5: int a,b,sum; 6: a=7; 7: b=8; 8: sum = a + b; 9: printf(“sum = %d\n”,sum); 10: return(0); 11:} #======== #========= gcc -g -o mygdbtest mygdbtest.c #======== #========= 程式2 #Objective C程式 – hello.m #import @interface HelloWorld : Object { STR str; } + alloc; - init; int main(); @end @implementation HelloWorld + alloc { return [super alloc]; } - init { str = "Hello, World!"; return [super init]; } - sayhello:(char *)gname { printf("%s %s\n",gname,str); } int main() { id hwobj = [[HelloWorld alloc] init]; [hwobj sayhello:"Tom"]; return 0; } @end #========