Reputation: 635
I have to convert java code to objective-c code. Here I have to write the following code and run on my terminal:
$ 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
To compile the translated file:
$ j2objcc -c Hello.m
$ j2objcc -o hello Hello.o
Here when I run $ j2objcc -o hello Hello.o on my terminal, I get the following error.
$ 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)
How can I resolve this error?
Upvotes: 0
Views: 2326
Reputation: 2044
You need to add the path to where you unzipped the j2objc distribution bundle. For example:
$ cd $HOME
$ unzip ~/Downloads/j2objc-*.zip
$ export PATH=${PATH}:${HOME}/j2objc
Note: the export command above needs to be added to your ${HOME}/.bashrc file so it's set when you log out and back in.
Upvotes: 2
Reputation: 795
You comment you are using XCode 3.2.6. Currently, J2ObjC seems to require XCode 4+.
Reference: https://code.google.com/p/j2objc/
Upvotes: 1