Compilation/ld problem
stephen@mombasa.anthro.utah.edu
stephen@mombasa.anthro.utah.edu
Sat Apr 1 00:00:00 GMT 2000
Short version:
Compilation fails on a simple program that uses
BigIntegers.
I am using RedHat 6.0, out of the box, and I installed gcc with
the following RPMs from rufus.w3.org:
gcc-2.95.2-3.i386.rpm
gcc-java-2.95.2-3.i386.rpm
gcc-libgcj-2.95.2-3.i386.rpm
cpp-2.95.2-3.i386.rpm
binutils-2.9.5.0.22-4.i386.rpm
---> My BigInteger Hello World looks like this:
cut->--------
import java.math.BigInteger;
public class Hello {
public static void main(String[] args) {
BigInteger test_integer = new BigInteger("1");
System.out.println("Hello World!");
}
}
cut->--------
When I compile it like this:
gcj -c Hello.java
gcj --main=Hello -o Hello Hello.o
I get the following errors:
Hello.o: In function `Hello::main(JArray<java::lang::String *> *)':
/home/stephen/bin/src/Java/Mars_II/Mars_II_New/Hello.java:5: undefined
reference to `_CL_Q34java4math10BigInteger'
/home/stephen/bin/src/Java/Mars_II/Mars_II_New/Hello.java:5: undefined
reference to `java::math::BigInteger::BigInteger(java::lang::String *)'
collect2: ld returned 1 exit status
Is there a way to fix this?
Thanks,
Steve
More information about the Java
mailing list