我必须将java代码转换为objective-c代码。在这里,我必须编写以下代码并在我的终端上运行:
$ cat Hello.java
public class Hello {
public static void main(String[] args) {
System.out.println("hello, world");
}
}
$ j2objc Hello.java
translating Hello.java
Translated 1 file: 0 errors, 0 warnings
编译翻译文件:
$ j2objcc -c Hello.m
$ j2objcc -o hello Hello.o
在这里,当我在终端上运行$ j2objcc -o hello Hello.o时,出现以下错误。
$ j2objcc -o hello Hello.o
Undefined symbols:
"_objc_autoreleasePoolPop", referenced from:
-[JavaLangThread run] in libjre_emul.a(Thread.o)
"_objc_autoreleasePoolPush", referenced from:
-[JavaLangThread run] in libjre_emul.a(Thread.o)
ld: symbol(s) not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
如何解决此错误?