XCode fails to build generic JNI project

John Chandler morph at growler.net
Sun Jan 27 19:03:35 PST 2008


I'm using XCode 2.5 and trying to figure out how to call Java methods  
from a Cocoa app.

I thought step 1 would be to build a trivial JNI project that does  
the more common opposite
thing, calling C functions from Java, so I fired up XCode, did a New  
Project, and specified
a "Java JNI Application".  When the files were created, I tried to  
build it, and it failed.  The
complaint is

     /Users/jmc/src/JiniTrivial/build/JiniTrivial.build/Release/ 
JNILib.build/Objects-normal/i386/JiniTrivialjnilib.o reference to  
undefined _printf

This is the do-nothing, empty app created by XCode.  It looks as  
though the linker is looking
for a system library that is missing, or is improperly specified, or  
is in a place the path to which
hasn't been supplied.

Is this an XCode bug that I can work around, or did something not get  
installed?  If I write a
trivial C program using a makefile, printf() works fine.

Naturally, I'd rather have trouble doing something that *should* be  
hard....

John Chandler
morph at growler.net





More information about the MacOSX-dev mailing list