Forward declaration of classes needed when using GCJ?

Andrew W ajwood@iee.org
Fri Feb 15 18:24:00 GMT 2008


OK I've solved  the problem when you've just got the two simple classes 
A & B. It seems is obscurely fussy about the current working directory.

It insists the current directory is the root of the project and you 
specify the .java files as a sub path below that it will NOT allow you 
to have the package dir containing the .java  files as the current 
directory. i.e

cd /path/to/project

gcj --main=net.mydomain.core.ClassA ./net/mydomain/core/ClassA.java 
./net/mydomain/core/ClassB.java

WILL work

cd /path/to/project/net/mydomain/core/

gcj --main=net.mydomain.core.ClassA ./ClassA.java ./ClassB.java

will NOT

Anyway.

If you then try linking against jar files using --classpath= you're back 
to square 1.

Taking the above example (the 1st one) if you copy any  .JAR file to 
/path/to/project/

 then do

gcj --main=net.mydomain.core.ClassA ./net/mydomain/core/ClassA.java 
./net/mydomain/core/ClassB.java --classpath='./lo4j-1.2.8.jar'

you get the same error about not recognising ClassB.

Even appending the current dir onto the end of the classpath doesnt 
solve it.

Any ideas?

Regards
Andrew





More information about the Gcc-help mailing list