object-c编译
程序员文章站
2022-03-22 08:10:22
...
例子1:
[size=large][b]WordLength1.m[/b][/size]
[b][size=large]WordLength1.sh脚本文件[/size][/b]
[size=large][b]WordLength1.m[/b][/size]
#import <Foundation/Foundation.h>
int main(int argc, const char *argv[]) {
const char *words[4] = {"aardvark", "abacus",
"allude", "zygote"};
int wordCount = 4;
int i;
for(i = 0; i < wordCount; i++) {
NSLog (@"%s is %d characters long",
words[i], strlen(words[i]) );
}
return (0);
}
[b][size=large]WordLength1.sh脚本文件[/size][/b]
#!/bin/sh
# Last Change: 2012-04-04 01:03:13
gcc -o WordLenght1 WordLenght1.m \
-fconstant-string-class=NSConstantString \
-I /GNUstep/System/Library/Headers/ \
-L /GNUstep/System/Library/Libraries/ \
-lobjc \
-lgnustep-base