Recent brief review under OC Open iterm Tool Input command
mkdir Reviewoc
Open Sublime text file
Open-a sublime\ Text
Write the following code:
1 #include <stdio.h>2//main entry for all Programs haha, not here. 3int Main () 4 {5 printf ("Hello OC \ n"); 6 }
Save As REVIEW01.M
Compile files in the Reviewoc directory cc-c review01.m
File without errors directly produces a REVIEW01.O file
Then execute the CC REVIEW01.O file
Generate executable file a.out
Execute command:./a.out
See the results as follows:
Correct output ha
It's still written in C, so now let's write an OC review02.m.
1 /**2 #import role 1: Copy the contents of the right file 2: can automatically prevent the contents of the file is repeated copy3 */4 #import<Foundation/Foundation.h>5 6 intMainintargcConst Char*argv[]) {7 @autoreleasepool {8 //Insert code here ...9NSLog (@"Hello, Real OC!");Ten } One return 0; A}
Error when executing cc REVIEW02.O command
Do you know what it is? Because our OC program introduces the foundation framework and therefore requires a compiler when linking, the framework I use is the foundation
CC Review02.o-framework Foundation
It's going to be all right, huh?
OC Basics Review 01-First OC Program