This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined reference


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]