In the old days I could have compiled objective-c .m files with
$ gcc -fobjc-gc-only -framework Foundation sample.m
$ ./a.out
But now it doesn't work because there is a high chance the program has
@autoreleasepool { ... }
clause. How do I compile an objective-C on command-line now?
So I just tried out clang
and it worked out beautifully.
$ clang -fobjc-gc-only -framework Foundation sample.m
$ ./a.out
2013-09-22 20:17:57.150 a.out[19858:903] Hello world.
Case closed! :)
xcodebuild is what the XCode IDE uses under the hood to build you app, and what you use in things like CI servers to kick off a build from the command line. It uses your .xcproj or .xcworkspace files to work out what to build, so that may still be too high level for you.
In which case, under xcodebuild is clang and llvm. Clang replaced gcc, and is somewhat backwardly compatible, so that would be where you would want to start I would think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With