Android noob: How to add existing C++ projects?

Sysprogs forums Forums VisualGDB Android noob: How to add existing C++ projects?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #749
    gettingHelp
    Participant

    Hi,

    I have a fairly large code base that I am trying to draw upon (parts of it at least) for my NDK app. I created a new NDK app project based upon the one of the examples and added it to the solution but I’m not clear on how to add the existing projects (and code) to the new NDK project. That is, when I #include the files, it doesn’t route to the correct places and the includes are not found. Moreover, when I try to add files to the .mk file it gets overwritten when i start the build.

    Any help/tutorial/suggestions would be great.

    Thank you!

    #2978
    ket
    Participant

    Hi,

    The Android NDK build system usually expects all the source files to be in the jni subdirectory of the project. VisualGDB updates the LOCAL_SRC_FILES list automatically on each build based on the files that are part of the project in VS. You can disable this behavior by removing the comment line above the variable.

    The simplest way to use your existing source in the new app would be to copy the sources to the jni directory and then adding them as existing items to the project in Visual Studio.

    You can also try to use the existing sources from their current location (disable the VisualGDB source files updating then). The source files should be added with their relative paths to LOCAL_SRC_FILES and the relative include directories to LOCAL_C_INCLUDES in Android.mk. Please read the ANDROID-MK.html documentation from the docs subdirectory of your Android NDK install directory for further information on these variables.

    #2979
    gettingHelp
    Participant

    Thanks, this helped.

    If I would have been able to dump everything in the JNI folder things would have been much easier.

    I played around with LOCAL_PATH and I think I have it moving in the right direction although I may have more questions later on 🙂

    Thank you for the prompt response!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.