Compiling Generics
BGB
cr88192@hotmail.com
Thu Mar 12 02:11:00 GMT 2009
----- Original Message -----
From: "Andrew Haley" <aph@redhat.com>
To: "Jacob Jennings" <jdjennin@gmail.com>
Cc: <java@gcc.gnu.org>
Sent: Thursday, March 12, 2009 3:52 AM
Subject: Re: Compiling Generics
> Jacob Jennings wrote:
>> 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".
>> I suspect you're just using an obsolete version of gcj. Generics have
> worked for a year now, since gcj 4.3.0.
>
except for those of us who use Cygwin or MinGW, where I think I installed a
newer MinGW not too long ago (back in January), and it is 3.4.5...
Cygwin was installed clean newer, and from what I remember, its version of
gcj is older...
but, all this is nothing new probably...
apps which use configure almost invariably fail to work as well.
invariably, they end up also depending on some library not present/working
(such as glib, which is by default absent on MinGW, and apparently broken on
Cygwin), or using some tool which is not present as part of the build
process (such as lex, yacc, or bison, or yet more obscure tools...), ...
but I guess all this just "comes with the territory" wrt building any
opensource apps on Windows...
or such...
> Andrew.
>
More information about the Java
mailing list