This is the mail archive of the
mailing list for the Cygwin project.
"undefined reference to `_JNI_CreateJavaVM'"
- From: Gary <cygwin at garydjones dot name>
- To: cygwin at cygwin dot com
- Date: Thu, 18 Feb 2010 11:43:10 +0100
- Subject: "undefined reference to `_JNI_CreateJavaVM'"
I am trying to call some Java code from C via JNI, and am having
main.o:main.c:(.text+0xcc): undefined reference to `_JNI_CreateJavaVM'
I've basically followed along with what is written at
http://www.inonit.com/cygwin/jni/invocationApi/ (built an import
library, passed ld the "-L. -ljvm" parameters, and so on). One difference
is that gcc no longer supports -mno-cygwin, but I'm not convinced that
is the cause.
I am trying to use the straight Windows Java at first, by specifying
-I$jdk/include and everything appears to compile okay, *but* if I also
specify -I$jdk/include/win32 (as per the above mentioned web pages) then
In file included from /mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:27,
/mnt/c/Programme/Develop/Java/SDK/jdk/include/win32/jni_md.h:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jlong'
In file included from myhdr.h:4,
/mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:108: error: expected specifier-qualifier-list before 'jlong'
/mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:316: error: expected specifier-qualifier-list before 'jlong'
Given that I appear to have two sets of JNI related include files and so
forth installed (Sun and gcc), I'm wondering if that's the cause -
should I actually be using the gcc supplied files in preference to the
Does anyone have any recent experience in this area they could share,
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple