gcj Newbie Question

Michael Koch konqueror@gmx.de
Fri Aug 27 19:57:00 GMT 2004


Am Freitag, 27. August 2004 06:58 schrieb Kyle Kinkaid:
> Dear Sirs:
>> I am learning Java using the book "Beginning Java 2" by
> Ivor Horton (ed. SDK 1.4) and have been using gcj to do my
> compiling. I have been successful up until Ch.5 (exercise
> "Testing the Geometry Package", p.219) where packages are
> taught. When I compile, I get "undefined reference to..."
> errors (as shown below).
>> The file with the main() method is called TryPackage.java
> which references classes Point and Line. Point.class and
> Line.class are stored in ./Geometry/. I get the error
> when I use my code (as copied from the book) or the code
> that can be downloaded from the publisher's (Wrox)
> website. When I use javac it compiles and runs fine. When
> I use gcj to goto byte code it runs fine (using java or
> gij). Only when I try to go from a class to a native
> executable (or direct from source to an executable) to I
> get the above error messages.
>> $ gcj -I. -o Trypackage --main=TryPackage TryPackage.java

This should work:
gcj -I. -o Trypackage --main=TryPackage TryPackage.java 
Geometry/Point.java Geometry/Line.java
You need to speficy all classes you need to link. Otherwise gcj will 
not use them.
Michael


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /