false error from Eclipse: Function '__android_log_print' could not be resolved (Android, CDT)

后端 未结 4 742
灰色年华
灰色年华 2021-02-06 04:16

I have an Android NDK project whose NDK part compiles ok from command line; I used to have no problems with running the compiled stuff from under Eclipse as a pure Java project.

4条回答
  •  半阙折子戏
    2021-02-06 04:58

    In your Android.mk file, please add

    LOCAL_LDLIBS := -llog -landroid
    

    The __android_log_print isn't part of libc, it's in the log library, so you need to explicitly declare it to be linked in.

    Note the eclipse will refuse to run the project if there's errors on either the C or java side. In this case, there's a linker error; the code didn't successfully finish compiling, so it won't run it.

提交回复
热议问题