简体   繁体   English

如何更改指向已删除的android-ndk-r9安装的内置C / C ++路径?

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

I recently upgraded my NDK from android-ndk-r9 to android-ndk-r10 (r10d to be exact). 我最近将我的NDK从android-ndk-r9升级到android-ndk-r10(确切地说是r10d)。 Eclipse is 4.4 Luna (Luna Service Release 1 (4.4.1); Build id: 20140925-1800). Eclipse是4.4 Luna(Luna Service Release 1(4.4.1); Build id:20140925-1800)。 Eclipse is fully patched for its release. Eclipse已完全修补它的发布。 I updated all the Eclipse plugins (including ADT) so they are fully patched. 我更新了所有Eclipse插件(包括ADT),以便完全修补它们。 And I also changed my ANDROID_NDK_ROOT in .bash_profile to point to the new NDK directory. 我还将.bash_profile ANDROID_NDK_ROOT更改为指向新的NDK目录。

Under the Eclipse Preferences → Android → NDK, Eclipse is showing the new android-ndk-r10 path (I had to set it manually). 在Eclipse Preferences→Android→NDK下,Eclipse显示了新的android-ndk-r10路径(我必须手动设置)。

Under the Project Properties → C/C++ General → Paths and Symbols, Eclipse is still showing the old android-ndk-r9 path. 在Project Properties→C / C ++ General→Paths and Symbols下,Eclipse仍然显示旧的android-ndk-r9路径。

在此输入图像描述

Eclipse considers the path built-in, and unchecking the Show built-in values check box makes all the paths disappear. Eclipse会考虑内置路径,并取消选中“ 显示内置值”复选框会使所有路径都消失。 In addition, the Edit... button is greyed out. 此外,“ 编辑...”按钮显示为灰色。

I've grepped the following directories, and I cannot find the string "android-ndk-r9" : 我已经grep了以下目录,我找不到字符串“android-ndk-r9”

  • My Eclipse workspace 我的Eclipse工作区
  • ~/.eclipse
  • The project's directory 项目的目录
  • ~/Library
  • /Application/Eclipse
  • /etc on the OS X machine OS X机器上的/etc
  • /Library on the OS X machine OS X机器上的/Library

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): (要复制,您需要打开C或C ++文件):

在此输入图像描述

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? 这似乎是相关的: 如何从Eclipse CDT项目在Linux上编译后删除自动发现的路径? . But I can't find Discovery Options → Clear discovery entries now (it appears to be a Eclipse 3.x feature). 但我现在找不到发现选项→清除发现条目 (它似乎是Eclipse 3.x功能)。 Ditto for Eclipse CDT Invalid Project Path . 同样适用于Eclipse CDT无效的项目路径


This appears to be the Eclipse bug report covering the issue: Include path discovery doesn't discard obsolete paths on compiler upgrade . 这似乎是关于该问题的Eclipse错误报告: 包含路径发现不会丢弃编译器升级时过时的路径

Where is the setting coming from? 设置来自哪里?

It appears the information is held in the project's pathInfo file. 看来信息保存在项目的pathInfo文件中。 Below, the project is a sample JNI project called AndroidPrng. 下面,该项目是一个名为AndroidPrng的示例JNI项目。

$ 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, " ... 我已经浏览了以下目录...... “我的Eclipse工作区,〜/。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 . 其次, org.eclipse.cdt.ui下的日志文件中的100个条目淹没了com.android.ide.eclipse.ndk 15个条目。

So, before you grep, perform: 所以,在你grep之前,执行:

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

That will produce manageable grep results. 这将产生可管理的grep结果。


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. 或者您可以删除它,Eclipse将使用新的NDK相关路径重新创建它。

OP probably figured this out already but adding this here just for future reference. OP可能已经想到了这一点,但在此处添加此仅供将来参考。

Eclipse (currently) has issues with the r10d version (see the related discussion in https://stackoverflow.com/a/28108753/1591421 ). Eclipse(当前)存在r10d版本的问题(请参阅https://stackoverflow.com/a/28108753/1591421中的相关讨论)。 First, if possible one should rollback to an earlier version of the Android NDK (eg r10c seems to work just fine) and then make Eclipse point to the newly installed version of the NDK: Preferences -> Android -> NDK -> NDK Location . 首先,如果可能,应该回滚到早期版本的Android NDK(例如r10c似乎工作得很好),然后让Eclipse指向新安装的NDK版本: 首选项 - > Android - > NDK - > NDK位置 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). 为了让Eclipse获取这些更改,需要从工作区中删除项目,然后再添加回来(至少我必须这样做)。 After the project has been re-imported one should see the NDK paths updated: Project -> Properties -> C/C++ General -> Paths and Symbols . 重新导入项目后,应该看到NDK路径已更新: 项目 - > 属性 - > C / C ++常规 - > 路径和符号 Rebuilding the C/C++ Index ( Project -> C/C++ Index -> Rebuild ) won't hurt either :) 重建C / C ++索引( 项目 - > C / C ++索引 - > 重建 )也不会伤害:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM