Eclipse CDT 抱怨未解析的功能,但仍能成功构建
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10103465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse CDT complains about unresolved functions but still builds successfully
提问by curvedvision
The following C++ application compiles and runs successfully within Eclipse CDT but the IDE is still reporting an error stating:
以下 C++ 应用程序在 Eclipse CDT 中成功编译并运行,但 IDE 仍报告错误,指出:
Could not resolve function wprintf
#include <stdio.h>
#include <wchar.h>
int main()
{
wprintf(L"Hello world");
return 0;
}
The directory /usr/include
(where wchar.h
resides) is definitely listed within the Include path as otherwise the application would not compile. Hitting F3 on wprintf
reports:
目录/usr/include
(wchar.h
所在的位置)肯定会列在包含路径中,否则应用程序将无法编译。在wprintf
报告上按 F3 :
Could not find symbol 'wprintf' in index
This is my set up:
这是我的设置:
- openSUSE 11.4
- Eclipse IDE for Java Developers (Indigo Service Release 2 - Build 20120216-1857)
- Eclipse CDT v8.0.2.201202111925
- openSUSE 11.4
- 面向 Java 开发人员的 Eclipse IDE(Indigo Service Release 2 - Build 20120216-1857)
- Eclipse CDT v8.0.2.201202111925
Does anyone know how I can get Eclipse CDT to resolve this function correctly?
有谁知道如何让 Eclipse CDT 正确解析此功能?
回答by user1523177
I had the same problem with my Juno Release, Build id: 20120510-1218 on Fedora 14. To solve the index problem: Navigate to preferences -> c/c++ -> Editor -> Indexer -> uncheck "Allow heuristic resolution of includes"
我的 Juno 版本也有同样的问题,在 Fedora 14 上构建 ID:20120510-1218。要解决索引问题:导航到首选项 -> c/c++ -> 编辑器 -> 索引器 -> 取消选中“允许包含的启发式解析”
-All the best
-祝一切顺利
回答by aphex999
At preferences -> c/c++ -> Editor -> Indexer disable indexer, apply, go back to preferences, and enable index again. This makes Eclipse to re-index the workspace. After that, my false red signs on the right side of the editor were gone.
在首选项 -> c/c++ -> 编辑器 -> 索引器禁用索引器,应用,返回首选项,然后再次启用索引。这使得 Eclipse 重新索引工作区。之后,我在编辑器右侧的虚假红色标志消失了。
回答by user2270507
what helped me was on the jni folder press the right mouse button properties > c/c++ general > paths and symbols add the same paths as in project > properties c/c++ general > paths and symbols
对我有帮助的是在 jni 文件夹上按鼠标右键属性 > c/c++ 常规 > 路径和符号添加与项目中相同的路径 > 属性 c/c++ 常规 > 路径和符号
hope it helps
希望能帮助到你
回答by ks1322
The directory /usr/include (where wchar.h resides) is definitely listed within the Include path as otherwise the application would not compile
目录 /usr/include(wchar.h 所在的位置)明确列在 Include 路径中,否则应用程序将无法编译
I guess this directory is listed only in compilerInclude path. This directory has to be listed in Eclipse C++ parserInclude pathas well, to resolve functions correctly.
我猜这个目录只在编译器包含路径中列出。该目录也必须列在Eclipse C++ 解析器的包含路径中,才能正确解析函数。
回答by Computer_guy
Ok, if /usr/include is listed correctly, then go to preferences -> c/c++ -> Editor -> Indexer -> select Indexer
好的,如果 /usr/include 被正确列出,那么去 preferences -> c/c++ -> Editor -> Indexer -> select Indexer
Sometimes change it from fast c/c++ indexer to the Full one resolves the problem.
有时将其从 fast c/c++ indexer 更改为 Full 可以解决问题。
Hope it helps
希望能帮助到你