This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: suggested FAQ
- From: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- To: Anthony Bucci <abucci at cs dot brandeis dot edu>
- Cc: java at gcc dot gnu dot org, gcc at gnu dot org
- Date: Fri, 16 May 2003 12:38:35 +0200 (CEST)
- Subject: Re: suggested FAQ
- References: <Pine.LNX.4.44.0305081531480.32632-100000@linux.local>
I didn't notice an update to the GCJ FAQ since your mail, so I'm hereby
forwarding this to our java mailing list.
Thanks for the feedback!
Gerald
On Thu, 8 May 2003, Anthony Bucci wrote:
> 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
>
--
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.pfeifer.com/gerald/