Re: Compiling Generics

Andrew John Hughes <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
2009/3/11 Jacob Jennings <[email protected]>:
> Hello, everyone. I just began using GCJ a short time ago, and I've
> just run into a bit of a problem--most likely stemming from my lack of
> knowledge about this compiler. In my Data Structures class, we program
> a lot using generics, and I'd love to use GCJ, but when I attempt to
> compile
>
> public class ListNode<E> {
> ...
> // blah blah, data members, constructors, methods, etc.
> }
>
> I get this error message:
>
> ListNode.java:1: error: '{' expected.
> public class ListNode<E> {
>                        ^
> ListNode.java:1: confused by earlier errors, bailing out
>
> Now when I compile this same code into bytecode with the Sun SDK, then
> compile the bytecode into machine code using GCJ, the compilation
> succeeds, and the resulting binary works perfectly fine. I would like
> to get away from using Sun's SDK unless I'm doing GUI programming. Is
> there a compile-time flag I'm missing or something? The command I'm
> trying to execute is "gcj -o LinkedQueue --main=LinkedQueue
> ListNode.java Queue.java LinkedQueue.java". Thank you.
>
> Jacob D. Jennings
>

What version of gcj are you using?
-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.