GCJ error compiling classes

Michael Koch konqueror@gmx.de
Sun Apr 17 20:03:00 GMT 2005


On Sun, Apr 17, 2005 at 08:54:21PM +0100, tt tt wrote:
> Apologies if this is the wrong list but I am
> completely stumped on this one!
>> I have been using javac (from the sun sdk) for a while
> now and it compiles my code fine. I have decided to
> give gcj a go but am receiving the following error
> message when compiling and using extra classes:
>> TestMySQL.o(.text+0x6e8): In function
> `TestMySQL::main(JArray<java::lang::String*>*)':
> /home/bob/p1/TestMySQL.java:134: undefined reference
> to `Job::class$'
> TestMySQL.o(.text+0x6f5):/home/bob/p1/TestMySQL.java:134:
> undefined reference to `Job::Job()'
> collect2: ld returned 1 exit status
>>> Contents of Class File:
>> class Job {
> public String job_id;
> }
>> Code line which failes in TestMySQL.java:
>> Job = new Job();
>> Compile options:
>> gcj -c -g -O TestMySQL.java <-- this line works fine
> gcj --main=TestMySQL -o TestMySQL TestMySQL.o

You need to compile and link all classes explicitely.
Use this:
gcj -c -g -O TestMySQL.java
gcj -c -g -O Job.java
gcj --main=TestMySQL -o TestMySQL TestMySQL.o Job.o
>> Both files are in the same directory.
>> Any ideas? Am I using the correct compile options? I
> am running gcc 3.4.3 on gentoo. All compiles and
> workds fine with javac

Michael
-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
Join the community at http://planet.classpath.org/


More information about the Java mailing list

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