This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
can't get a simple package example to compile with gcj
- From: Christopher Marshall <christopherlmarshall at yahoo dot com>
- To: java at gcc dot gnu dot org
- Date: Wed, 22 Oct 2003 07:24:28 -0700 (PDT)
- Subject: can't get a simple package example to compile with gcj
I am having trouble getting a very simple java program to compile with gcj in which the
main java file invokes a constructor on a class defined in a package.
I have the CLASSPATH variable set to '.' (the current directory).
Here's the main program, which is in the directory I am invoking gcj from:
// pkgtest.java
import java.io.*;
import A.*;
public class pkgtest {
public static void main(String args[]){
A.B x= new A.B(3);
System.out.println(x.x);
}
}
And in a subdirectory A, I put B.java:
// A/B.java
package A;
public class B{
int x;
public B(int i){
x= i;
}
}
I run gcj like this:
gcj --main=pkgtest -o pkgtest pkgtest.java
and get the following errors:
/tmp/ccx4zVVY.o(.text+0x2a): In function `pkgtest::main(JArray<java::lang::String*>*)':
: undefined reference to `A::B::class$'
/tmp/ccx4zVVY.o(.text+0x3f): In function `pkgtest::main(JArray<java::lang::String*>*)':
: undefined reference to `A::B::B[in-charge](int)'
collect2: ld returned 1 exit status
What's going on?
Chris Marshall
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com