can't get a simple package example to compile with gcj

Christopher Marshall christopherlmarshall@yahoo.com
Wed Oct 22 14:24:00 GMT 2003


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /