public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* suggested FAQ
@ 2003-05-08 17:14 Anthony Bucci
  2003-05-16 11:03 ` Gerald Pfeifer
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Bucci @ 2003-05-08 17:14 UTC (permalink / raw)
  To: gcc

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 \rain':
/tmp/cc2d4YQr.o(.text+0x2b): undefined reference to \x14est::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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: suggested FAQ
  2003-05-08 17:14 suggested FAQ Anthony Bucci
@ 2003-05-16 11:03 ` Gerald Pfeifer
  0 siblings, 0 replies; 2+ messages in thread
From: Gerald Pfeifer @ 2003-05-16 11:03 UTC (permalink / raw)
  To: Anthony Bucci; +Cc: java, gcc

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 \x14est::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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-16 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-08 17:14 suggested FAQ Anthony Bucci
2003-05-16 11:03 ` Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).