Skip to content

Instantly share code, notes, and snippets.

@ikuwow
Created September 22, 2014 10:55
Show Gist options
  • Save ikuwow/04c22f0667eacf8950e1 to your computer and use it in GitHub Desktop.
Save ikuwow/04c22f0667eacf8950e1 to your computer and use it in GitHub Desktop.
MacのターミナルでObjective-Cをコンパイルする方法 ref: http://qiita.com/ikuwow/items/5470ffea3bf7403fe0a7
$ gcc -c main.m
$ gcc -c main.m
$ gcc -c Song.m
$ gcc -c Singer.m
$ gcc -o myFirstProgram main.o Song.o Singer.o -framework Foundation
#import "Song.h"
#import "Singer.h"
int main(void) {
id song;
id singer;
song = [[Song alloc] init];
[song setLyrics:@"それが僕達の奇跡"];
singer = [[Singer alloc] init];
[singer setSong:song];
[singer sing];
return 0;
}
#import <Foundation/NSObject.h>
#import <stdio.h>
(略)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment