This is the mail archive of the cygwin mailing list for the Cygwin 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]

"undefined reference to `_JNI_CreateJavaVM'"


I am trying to call some Java code from C via JNI, and am having
problems building:

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.

Further information:
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
compilation fails:

In file included from /mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:27,
                 from myhdr.h:4,
                 from main.c:1:
/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,
                 from main.c:1:
/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
Sun ones?

Does anyone have any recent experience in this area they could share,
please?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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