How to change built-in C/C++ paths pointing to a deleted android-ndk-r9 installation?

余生长醉 提交于 2020-01-11 06:15:32

问题


I recently upgraded my NDK from android-ndk-r9 to android-ndk-r10 (r10d to be exact). Eclipse is 4.4 Luna (Luna Service Release 1 (4.4.1); Build id: 20140925-1800). Eclipse is fully patched for its release. I updated all the Eclipse plugins (including ADT) so they are fully patched. And I also changed my ANDROID_NDK_ROOT in .bash_profile to point to the new NDK directory.

Under the Eclipse Preferences → Android → NDK, Eclipse is showing the new android-ndk-r10 path (I had to set it manually).

Under the Project Properties → C/C++ General → Paths and Symbols, Eclipse is still showing the old android-ndk-r9 path.

Eclipse considers the path built-in, and unchecking the Show built-in values check box makes all the paths disappear. In addition, the Edit... button is greyed out.

I've grepped the following directories, and I cannot find the string "android-ndk-r9":

  • My Eclipse workspace
  • ~/.eclipse
  • The project's directory
  • ~/Library
  • /Application/Eclipse
  • /etc on the OS X machine
  • /Library on the OS X machine

The project builds fine. The bad configuration just creates hundreds of errors in the list on the Problems tab. (To duplicate, you need to open a C or C++ file):

Where is the setting coming from? And how do I change it?


This appears to be related: How to remove auto-discovered paths after compiling on Linux from Eclipse CDT project?. But I can't find Discovery Options → Clear discovery entries now (it appears to be a Eclipse 3.x feature). Ditto for Eclipse CDT Invalid Project Path.


This appears to be the Eclipse bug report covering the issue: Include path discovery doesn't discard obsolete paths on compiler upgrade.


回答1:


Where is the setting coming from?

It appears the information is held in the project's pathInfo file. Below, the project is a sample JNI project called AndroidPrng.

$ cat /Users/jww/Eclipse/.metadata/.plugins/com.android.ide.eclipse.ndk/AndroidPrng.pathInfo 
t,1421045575000
i,/opt/android-ndk-r9/sources/cxx-stl/stlport/stlport
i,/usr/local/cryptopp/android-armeabi/include
i,/opt/android-ndk-r9/sources/cxx-stl/system/include
i,/usr/local/cryptopp/android-armeabi/include/cryptopp
i,jni
i,/opt/android-ndk-r9/platforms/android-14/arch-arm/usr/include
i,/usr/local/cryptopp/android-x86/include
i,/usr/local/cryptopp/android-x86/include/cryptopp
i,/opt/android-ndk-r9/platforms/android-14/arch-x86/usr/include
i,/usr/local/cryptopp/android-mips/include
i,/usr/local/cryptopp/android-mips/include/cryptopp
i,/usr/local/cryptopp/android-armeabi-v7a/include
i,/usr/local/cryptopp/android-armeabi-v7a/include/cryptopp
i,/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include
i,/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include-fixed
i,/opt/android-ndk-r9/platforms/android-14/arch-mips/usr/include
d,__STDC__,1
d,__INT64_MAX__,9223372036854775807LL
d,__LDBL_HAS_QUIET_NAN__,1
d,__WINT_TYPE__,unsigned int
d,__ORDER_LITTLE_ENDIAN__,1234
d,__DEC64_MAX_EXP__,385
d,__UINT_LEAST32_TYPE__,unsigned int
d,__UINT_FAST64_TYPE__,long long unsigned int
d,__GXX_WEAK__,1
...

I've grepped the following directories ... "My Eclipse workspace, ~/.eclipse, " ...

There were two problems here. First, the project is located on my desktop, and not my workspace directory. Second, the 100's of entries in the log files under org.eclipse.cdt.ui drowned out the entries 15 entries for com.android.ide.eclipse.ndk.

So, before you grep, perform:

rm Users/jww/Eclipse/.metadata/.plugins/org.eclipse.cdt.ui/*.log

That will produce manageable grep results.


And how do I change it?

Exercise left to the reader.

You can edit by hand; or you can delete it and Eclipse will recreate it with the new NDK-related paths.




回答2:


OP probably figured this out already but adding this here just for future reference.

Eclipse (currently) has issues with the r10d version (see the related discussion in https://stackoverflow.com/a/28108753/1591421). First, if possible one should rollback to an earlier version of the Android NDK (e.g. r10c seems to work just fine) and then make Eclipse point to the newly installed version of the NDK: Preferences -> Android -> NDK -> NDK Location. To let Eclipse pick up these changes the project needs to be deleted from the workspace and then added back (at least I had to). After the project has been re-imported one should see the NDK paths updated: Project -> Properties -> C/C++ General -> Paths and Symbols. Rebuilding the C/C++ Index (Project -> C/C++ Index -> Rebuild) won't hurt either :)



来源:https://stackoverflow.com/questions/27898114/how-to-change-built-in-c-c-paths-pointing-to-a-deleted-android-ndk-r9-installa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!