suggested FAQ
Anthony Bucci
abucci@cs.brandeis.edu
Thu May 8 17:14:00 GMT 2003
Hi,
I have a suggested question/answer for the gcj FAQ. I have seen variants of
this same question come up again and again on newsgroups, and I believe it's
because of the same point of confusion.
--------
Q. I am trying to compile a Java class Test in package foo, and I get
"undefined reference to 'Test::class$'" errors. Help!
A. You are not including the fully-qualified class name in the --main switch
to gcj. For class Test in package foo, the following command will result in
an error:
> gcj -o Test --main=Test foo/Test.java
/tmp/cc2d4YQr.o: In function
ain':
/tmp/cc2d4YQr.o(.text+0x2b): undefined reference to est::class$'
The correct way to compile this class is to issue:
> gcj -o Test --main=foo.Test foo/Test.java
> ./Test
Hello world
This is similar to how you'd do the same with javac and java:
> javac foo/Test.java
> java foo.Test
Hello world
-------
Sincerely,
Anthony Bucci
More information about the Gcc
mailing list