linking issue on basic example
Julien Guyon
julien.guyon@loria.fr
Wed Feb 12 14:42:00 GMT 2003
Working on Freebsd 4.7, with CLASSPATH = . , I m not able to make this
simple example run...
# cat Hello.java
import hello2.*;
import java.io.*;
public class Hello {
public Hello() { System.out.println("My hello classprog"); }
public static void main(String args[]) {
Hello hello = new Hello();
Hello2 hello2 = new Hello2();
}
}
# cat hello2/Hello2.java
package hello2;
import java.io.* ;
public class Hello2 {
public Hello2() { System.out.println("My hello2 class prog"); }
}
# gcj -C Hello.java; gij Hello
My hello classprog
My hello2 class prog
=====> OK and also with javac/jikes and java
but
#../bin/gcj --main=Hello -pthread -o hy Hello.java
/var/tmp//cc4QNRPg.o: In function
`Hello::main(JArray<java::lang::String*>*)':
/var/tmp//cc4QNRPg.o(.text+0xb2): undefined reference to `Hello2::class$'
/var/tmp//cc4QNRPg.o(.text+0xc5): undefined reference to
`Hello2::Hello2[in-charge]()'
collect2: ld returned 1 exit status
Maybe usefull to help me:
# gcj -v
Reading specs from
/home/julien/TOOLS/GCJ/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.2/specs
Reading specs from
/home/julien/TOOLS/GCJ/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.2/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../gcc/configure --enable-threads=posix
--prefix=/home/julien/TOOLS/GCJ --enable-shared --enable-languages=c++,java
Thread model: posix
gcc version 3.2.2
GNU ld version 2.12.1 [FreeBSD] 2002-07-20
Any ideas ??
More information about the Java
mailing list