GCC complaining about undefined symbols when trying to compile .o for using as JNI.

Discussion in 'Mac Programming' started by ColdStone, Jul 24, 2011.

  1. ColdStone macrumors newbie

    Jul 24, 2011
    I have some JNI code that I wrote using the some java code for android platform in 10.7 (Lion) and Xcode 4.3, but when I try to use the gcc, I get some strange errors.

    Here is the output of mine, can anyone tell me whats going on?


    MacBook-Pro:JNI $$ cc -dynamiclib -o hellojni.jnilib hellojni.o -framework JavaVM
    Undefined symbols for architecture x86_64:
      "_print", referenced from:
          _Java_HelloJNI_printHello in hellojni.o
          _Java_HelloJNI_printString in hellojni.o
         (maybe you meant: _Java_HelloJNI_printHello, _Java_HelloJNI_printString )
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    The code is using a symbol named 'print', but there is no such function or global defined in any referenced library.

    The 'print' symbol is used from two different functions. Their names are given.

    There's no way to tell anything else without seeing the source C file that was compiled to produce hellojni.o.

Share This Page