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

后端 未结 4 680
灰色年华
灰色年华 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:44

    How it can be ignored: open 'Problems' window, select errors in c/c++ files and press Del key. A confirmation msg box will be shown, but after that you can debug your app... until next rebuild =) Alternatively, as you mentioned earlier, you can just close all opened c/c++ files.

    0 讨论(0)
  • 2021-02-06 04:53

    The configuration of CDT indexer needs to enable "Index unused headers ..."

    How to get there: Project->Properties->C/C++ General->Indexer.

    Gets rid of the error for me.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-06 05:00

    alternatively you can retype these strings and restart an Eclipse; All these fixes sounds lame though...

    0 讨论(0)
提交回复
热议问题