1:对比JAVA主函数。

新建两个类TestNihao1和TestNihao2.

 


XCode主函数
 

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;
}

 运行时出现如下异常


XCode主函数
 

 

 

 

相关文章:

  • 2021-12-19
  • 2022-01-18
  • 2021-07-23
  • 2021-11-07
  • 2021-12-01
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
相关资源
相似解决方案