This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: how to compile multi classed?
- To: Niklas Fondberg <niklas dot fondberg at i3micro dot com>
- Subject: Re: how to compile multi classed?
- From: Alexandre Petit-Bianco <apbianco at cygnus dot com>
- Date: Tue, 4 Sep 2001 12:29:31 -0700 (PDT)
- Cc: java at gcc dot gnu dot org
- References: <999630407.3b952647728ac@greyhound.i3micro.se>
- Reply-To: apbianco at cygnus dot com
Niklas Fondberg writes:
> I have three source *.java files:
> 2 are classes that are called from the first class (containing main)
> How are one to compile this?
>
> gcj --main=First First.java -o First.o
> undefined reference to Second et.c.
You can do something like:
gcj -c First.java
gcj -c Second.java
gcj -c Third.java
gcj --main=First First.o Second.o Third.o
Which will generate three object files from your three source files
(`-c' flag) and then link them together to produce the `a.out'
executable.
Or you can also do:
gcj First.java Second.java Third.java --main=Third
> gcj -C Second.java
> gcj -C Third.java
Did you mean `-c'? `-C' makes gcj generate bytecodes files rather than
native object files.
> when adding package to Second.java and Third.java I get an error that
> it is read for the second time.
What does the command line look like and what is the message gcj
prints?
./A