linking issue on basic example

Tom Tromey tromey@redhat.com
Wed Feb 12 18:17:00 GMT 2003


>>>>> "Julien" == Julien Guyon <julien.guyon@loria.fr> writes:

Julien> but  #../bin/gcj --main=Hello -pthread -o hy Hello.java
Julien> /var/tmp//cc4QNRPg.o: In function
Julien> `Hello::main(JArray<java::lang::String*>*)':
Julien> /var/tmp//cc4QNRPg.o(.text+0xb2): undefined reference to `Hello2::class$'
Julien> /var/tmp//cc4QNRPg.o(.text+0xc5): undefined reference to
Julien> `Hello2::Hello2[in-charge]()'
Julien> collect2: ld returned 1 exit status

You have to also compile and link in Hello2.java.

For instance you could use

    gcj -c Hello.java
    gcj -c Hello2.java
    gcj --main=Hello -o hy Hello.o Hello2.o

Tom



More information about the Java mailing list