简体   繁体   English

切换到GCC 4.8后,Eclipse不更新Android NDK项目的“内置”包含路径

[英]Eclipse not updating “built-in” include paths for Android NDK Project after switching to GCC 4.8

I have an Android/Eclipse project that uses the NDK and I've recently enabled c++11 support by adding the following to my Application.mk file: 我有一个使用NDK的Android / Eclipse项目,并且最近通过将以下内容添加到我的Application.mk文件中启用了c ++ 11支持:

NDK_TOOLCHAIN_VERSION := 4.8 #same result here with clang
APP_CPPFLAGS += -std=c++11

This basically works fine, c++11 features are available and compile as expected. 这基本上可以正常工作,可以使用c ++ 11功能并按预期进行编译。 This goes for ndk-build and Eclipse builds (which just invoke nkd-build), but the eclipse code parser becomes confused now. 这适用于ndk-build和Eclipse构建(仅调用nkd-build),但是eclipse代码解析器现在变得混乱。 When I open a file that uses types added to the STL in c++11 (like for example std::unique_ptr ), I get red squiggles and an error entry in the Problems tab saying Symbol 'unique_ptr' could not be resolved . 当我打开一个使用在c ++ 11中添加到STL中的类型的文件(例如std::unique_ptr )时,出现红色字形,并且在“ 问题”选项卡中显示一条错误条目,提示Symbol 'unique_ptr' could not be resolved This wouldn't be so bad, but if errors are present in that list Eclipse refuses to launch (or debug) the application. 情况还不错,但是如果该列表中存在错误,Eclipse将拒绝启动(或调试)该应用程序。 Right-clicking on the #include <memory> line and selecting Open Declaration also opens the wrong (4.6) file. 右键单击#include <memory>行,然后选择“ 打开声明”也会打开错误的(4.6)文件。

When checking the project properties under C/C++ General --> Paths and Symbols --> Includes it still lists the old (4.6) includes when Show Built-in values is ticked: Screenshot C / C ++常规->路径和符号->包含下检查项目属性时,当选中“ 显示内置值”时,它仍列出旧的(4.6)包含: 屏幕截图

Are those just cached from somewhere and I can get it to re-generate those entries? 那些只是从某个地方缓存的,我可以重新生成这些条目吗? I've obviously tried to Clean and Rebuild the project, with no effect. 我显然已经尝试清除并重建项目,但没有任何效果。 I'd rather not add them manually if that can be avoided, upgrading the NDK to new versions already requires quite a few changes until it compiles again. 如果可以避免,我宁愿不手动添加它们,将NDK升级到新版本已经需要进行很多更改,直到再次编译。 Where are these entries generated from and how do I trigger an update? 这些条目是从哪里生成的,以及如何触发更新?

I wish I could say I have a definitive answer for you, as I've been battling this problem for quite a while myself, but I do have a decent workaround. 我希望我能对您有一个明确的答案,因为我本人一直在与这个问题作斗争很长时间,但是我确实有一个不错的解决方法。 For starters, the "built-in" entries under "CDT Managed Build Setting Entries", are generated based on the contents of your Application.mk file which is located in the jni directory. 对于初学者,“ CDT管理的构建设置条目”下的“内置”条目是根据jni目录中Application.mk文件的内容生成的。 There is no other way of changing them, and these are what populate the "Includes" section in the C++ perspective's Project Explorer. 没有其他方法可以更改它们,而这些正是填充在C ++透视图的项目浏览器中的“包含”部分的内容。 But I see that must have read the documentation.html in the NDK installation to see what to put in that file already. 但是我看到必须阅读NDK安装中的documentation.html才能看到已经在该文件中放入了什么。 The issue then becomes that as soon as you change something or breathe too hard, your includes suddenly and irreversably become unresolved. 问题变成一旦您改变某些东西或呼吸太剧烈,您的内含物就会突然且不可逆转地变得无法解决。 The workaround for this is to recall the exact path of each include entry, right-click on the project, go to New->Folder , then in the dialog click Advanced , and select Link to Alternate Location (Linked Folder) . 解决方法是调用每个包含条目的确切路径,右键单击项目,转到“ New->Folder ,然后在对话框中单击“ Advanced ,然后选择“ Link to Alternate Location (Linked Folder) Then navigate to the path (or extend a variable if you are fancy) of the include folder, rename it something descriptive (you can't have 4 linked folders named "include"), and voilà! 然后导航到include文件夹的路径(如果愿意,可以扩展一个变量),将其重命名为描述性的名称(您不能有4个名为“ include”的链接文件夹),然后瞧瞧! You suddenly have a usable workspace again. 您突然又有了一个可用的工作空间。 I guess the "Includes" section functionality is a bit flimsy still, at least for ADT, and doing this puts the includes on the same footing as other files that are actually in your project. 我猜想,“包含”部分的功能仍然有些脆弱,至少对于ADT而言如此,这样做会使包含与项目中实际存在的其他文件处于相同的状态。 I'd be thrilled if the officially sanctioned mechanism started to work reliably, and I eagerly await news of such. 如果正式批准的机制开始可靠地运作,我会感到非常兴奋,并且我热切地等待着这样的消息。 HTH! HTH!

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

相关问题 如何更改指向已删除的android-ndk-r9安装的内置C / C ++路径? - How to change built-in C/C++ paths pointing to a deleted android-ndk-r9 installation? eclipse如何在Android NDK构建文件中设置路径和符号中的包含路径 - How is eclipse setting the include paths in Paths and Symbols from Android NDK build files 在Eclipse for Android NDK项目(Mac)中包括c ++头 - To include c++ headers in Eclipse for Android NDK project(Mac) Android NDK在Eclipse中包含路径 - Android NDK Include Path In Eclipse 在最新的 NDK 更新和 gcc 弃用后无法构建 Android NDK 项目 - Canot build Android NDK project after latest NDK update and gcc deprecation eclipse opencv android ndk:由于“&#39;NUL&#39;在该平台上是无效名称”,因此未构建该项目。 - eclipse opencv android ndk: The project was not built due to “'NUL' is an invalid name on this platform.” 在Android NDK代码中#include时,为什么看不到包含路径? - Why are include paths unseen when #include in Android NDK code? C ++ 11 cmath函数不在android NDK w / gcc-4.8或clang 3.4的std命名空间中 - C++11 cmath functions not in std namespace for android NDK w/gcc-4.8 or clang 3.4 蚀不更新Android项目 - eclipse not updating android project 将uuid.h包含到Android NDK项目中 - Include uuid.h into Android NDK project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM