undefined reference
Martin Egholm Nielsen
martin@egholm-nielsen.dk
Tue Jun 22 14:05:00 GMT 2004
Hi there,
> I am trying out gcj to compile java code to native binaries.
> When trying to compile this with:
> gcj --main=Test --classpath=.:/usr/share/java/log4j-1.2.jar Test.java
> I get the following error message:
> ------/-------
> /tmp/ccGtPlNJ.o(.text+0x54): In function `Test::Test[in-charge]()':
> : undefined reference to `org::apache::log4j::Logger::getRootLogger()'
> /tmp/ccGtPlNJ.o(.data+0x4): undefined reference to `org::apache::log4j::Logger::class$'
> collect2: ld returned 1 exit status
> ------/-------
> I am using gcj 3.3.4 under Debian sid.
> Any ideas where the problem is?
You need a binary version of the log4j package. Try doing it in steps
instead:
$ gcj -I. -I/usr/share/java/log4j-1.2.jar Test.java -o Test.o
$ gcj -c /usr/share/java/log4j-1.2.jar -o log4j-1.2.o
$ gcj --main=Test -o Test Test.o log4j1-1.2.o
I think that'll work...
Martin
More information about the Java
mailing list