This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
undefined reference to `__JArray type_info function'
- To: java-discuss@sourceware.cygnus.com
- Subject: undefined reference to `__JArray type_info function'
- From: ashe@boulder.qms.com (Steven Ashe)
- Date: Fri, 27 Aug 99 13:27:27 MDT
Look's like I'm doing something wrong... Anyone have any ideas?
With gcc-2.95 and libgcj-2.95.1 I get this when trying to link native code:
test6.o: In function `JArray<int> type_info function':
/home/ashe/java/test6.cc:6: undefined reference to `__JArray type_info function'
/home/ashe/java/test6.cc:6: undefined reference to `__JArray type_info node'
here's the Java:
---------------
public class Test6 {
public native int test6(int[] a);
public static void main(String[] args) {
Test6 t = new Test6();
int[] a = new int[72];
a[0] = 42;
System.out.println(t.test6(a));
}
}
here's the C++ (test6.cc):
-------------------------
#include <cni.h>
#include <Test6.h>
jint Test6::test6(jintArray a)
{
jint *p = elements(a);
return p[0];
}
and here's the compilation (split on to several lines):
------------------------------------------------------
gcj -C Test6.java
gcj -c -g Test6.class
gcjh Test6
g++ -c -Wall -fvtable-thunks -g -I.\
-I/usr/local/src/libgcj-2.95.1/libjava/include\
-I/usr/local/src/libgcj-2.95.1/libjava \
-I/usr/local/src/LIBGCJ_TARGET/i686-pc-linux-gnu/libjava/include\
-I/usr/local/src/LIBGCJ_TARGET/i686-pc-linux-gnu/libjava/ test6.cc
gcj --main=Test6 test6.o Test6.o -o Test6
test6.o: In function `JArray<int> type_info function':
test6.cc:6: undefined reference to `__JArray type_info function'
test6.cc:6: undefined reference to `__JArray type_info node'
collect2: ld returned 1 exit status
Thanks in advance.