X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Date: Thu, 18 Feb 2010 11:43:10 +0100 From: Gary To: cygwin AT cygwin DOT com Subject: "undefined reference to `_JNI_CreateJavaVM'" Message-ID: <20100218104310.GB3156@mimosa.garydjones.name> Mail-Followup-To: cygwin AT cygwin DOT com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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