This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
suggested FAQ
- From: Anthony Bucci <abucci at cs dot brandeis dot edu>
- To: gcc at gnu dot org
- Date: Thu, 8 May 2003 15:49:30 -0400 (EDT)
- Subject: suggested FAQ
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