[SOLVED] undefined reference to orxMain (Android)

edited October 2011 in Help request
I'm on the verge of getting my game compiled and running on Android, after a long day of tinkering in Android.mk, the Android manifest, and something like a dozen other files.

I'm nearing the end, and I just have to compile my C/C++ library with ndk-build. The compiling gets done just fine (near as I can tell), but when it's linking I keep getting the following error:
 In function `Java_org_orxproject_lib_AnOrxActivity_nativeInit':
/media/DATAPART1/work/orx/orx_svn/orx_svn/code/build/android/jni/../../../plugins/Display/android/android-support.cpp:120: undefined reference to `orxMain'

Has anyone seen anything similar? Or have any ideas what might be at issue?


  • edited October 2011

    Just a quick reply. I think you use an old version of the Android port.

    Do you use the latest svn version ? (the trunk)
  • edited October 2011
    Hmm. For my Android development I've been using the package orx-full-android-1.3rc0 available on SourceForge. Should I specifically be using the SVN version?

    If so, what am I missing by using the non-SVN version? Should I just change my current Android.mk makefile to point at the SVN-built libs instead of the orx-full-android-1.3rc0 ones?

  • edited October 2011

    Yes, I think you should use the current svn version. Lydesik completly change the code. Now, the svn use a NVidia framework to replace the OrxLib java part. It's more efficient and more clean. There's alors a multitouch support.

    Your Android.mk doesn't need some change, or perhaps, really minor change.

    I suggest you to get the latest svn and try to run the demo on your device.

    If you want to build orx for Android, I think you have to build it using a standalone toolchains (because it's the way to compile a library for Android, the ndk-build script only works for project, Lydesik can explain better then me I suppose).

    I will get the latest svn version too (not today, I can't) to check if the liborx.a for android is up to date, it's not sure. And after that, I will check the demo too.

    So, first step for you : get the latest svn and run the demo.

    I hope this help !
  • edited October 2011

    I'm following the instructions posted here, and everything works up until the actual deployment.

    - The toolchain is built
    - Orx for Android is compiled without error
    - The liborxTest.so library is compiled without error
    - The OrxTest project is imported into Eclipse

    I was expecting that when I right-clicked on the project name in Eclipse and hit "Build Project" that an .apk would be built in my bin/ directory, but that wasn't the case. Instead I went to Android Tools -> Export Unsigned Application Package and generated the .apk from there.

    Once transferred to my device, I ran the .apk, but I was just given a silent error that "The application was not installed."

    I'm at a bit of a loss. Many thanks for your help thus far though!
  • edited October 2011
    Hm. Alright, I tried again with Android Tools -> Export Signed Application Package, and it worked: the OrxTest project installed and ran on my phone.

    Are there any best practices for providing a signature?

    Anyway, with that complete, the next step is to create, compile, and deploy my own Orx project.

    - Does this all still have to be done within the Android NDK folder, as indicated in the wiki?
    - Can I simply copy-paste the OrxTest project, and then substitute my code in the jni/ directory?
    - If I do so, obviously this will require that I change the Android.mk, AndroidManifest.xml, and OrxDemo.java files to reflect my own project. But is that all?

    Thanks for any advice you can give.
  • edited October 2011

    It's weird, in my case, the apk is build correctly (and automaticaly) using eclipse.

    You don't have any problem to compile your project ? There's no error ? When you build your project, there's nothing in the log (in the eclipse console) ?

    I don't remember my first test, but perhaps there's something to do to enable a "debug signed application" ... Do you enable debugging on your phone ?

    Only orx have to be in the NDK/sources folder, it's not necessary for your project (but your have to reference orx library in the NDK/sources/orx folder, in the Androik.mk)

    Your source can be outside the jni directory if you make an Android.mk file correctly. It's my case in my current project.

    For the android.mk and manifest, yes, take a look, understand them, and report the same settings in your project.

    The orxdemo.java is sufficient too. You only need a similar class that load your game library (generated by the ndk-build process). This code is like that :

    Note: in my case, in my NDK/sources folder, I have a link to my current orx version, located in an other place on my hard drive.

    Hope this help !

    Edit :
    I suppose that when you build your game using ndk-build, Android know where are the orx library because of those lines (in the Android.mk of your game) :
    $(call import-module,orx/code/build/android)
    $(call import-module,orx/extern/Box2D_2.1.3/build/android)
    $(call import-module,orx/extern/SOIL/build/android)
    $(call import-module,orx/extern/NvEvent/build)
  • edited October 2011
    Okay, I got it (temporarily) working; saw the title screen working on my phone! Still have some issues---it doesn't seem responsive to touch, though that might just be a problem with the size of my on-screen buttons.

    Now I've got to figure out why Eclipse doesn't seem to be building the Android package automatically; I'm still having to explicitly export a signed .apk myself. Anyway, that's all configuration issues on my end, so the short answer to this thread: use the updated Orx build from SVN ;)

    Thanks for the help.

  • edited October 2011

    For the multitouch, take a look here :


    I sent a usefull .zip file to help.

    I suppose you have seen the nvdia framework, and I suppose you derive the NvEventQueueActivity. This class provide a public boolean, called "wantsMultitouch"

    So, if you want the multitouch working, you have to add this line to your onCreate(Bundle icicle) method :
    wantsMultitouch = true;

    I didn't remember what's the default value for this member, and I think if you set false, the orxMouse_XXX function works.

    And I think that when multitouch is set to true, orxMouse_XXX are functionnal for the first touch only (but I'm not sure, I can take a look if you really want).

    For now, there's no module for multitouch in orx, so you have to manage it by yourself using special event (read the post in the link above).

    Cheers !
  • edited October 2011
    Not using multitouch in this project, but it'll be good to know.

Sign In or Register to comment.