This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: newbie linker question
- From: Tom Tromey <tromey at redhat dot com>
- To: mabramso at gmu dot edu
- Cc: java at gcc dot gnu dot org
- Date: 18 Oct 2002 13:35:44 -0600
- Subject: Re: newbie linker question
- References: <cd4rbjzhlm.fsf@sun23.aic.nrl.navy.mil>
- Reply-to: tromey at redhat dot com
>>>>> "Myriam" == Myriam Abramson <mabramso@gmu.edu> writes:
Myriam> But when I try to compile a java class referring to other java
Myriam> classes in the same directory I get a linker error:
Myriam> gcj3 --main=package.Main -o Main Main.java
Myriam> gives me "Undefined reference to package::Utils.class"
Myriam> What am I missing?
You have to compile package.Utils and link it into the executable.
It's perhaps easier if you think about it like building a C program,
not building a Java program. First you compile everything to .o.
Then you link the .o files together to make the executable.
Tom