1:对比JAVA主函数。
新建两个类TestNihao1和TestNihao2.
public class TestNihao1 { public static void main(String[] args) { System.out.println("JAVA 主函数 1"); } }
public class TestNihao2 { public static void main(String[] args) { System.out.println("JAVA 主函数 2"); } }
2:XCode 只能有一个主函数main.m
所有事件都在主函数main.m中的main方法执行。
新建另一个带有主函数的Count-1-1.m
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... NSLog(@"XCode other main"); } return 0; }
运行时出现如下异常