Eclipse CDT索引器-如何解决未解决的问题 [英] Eclipse CDT indexer - how to solve unresolved includes

查看:162
本文介绍了Eclipse CDT索引器-如何解决未解决的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个项目的工作区,这些项目都可以毫无问题地编译.但是,由于未解决的包含,某些项目在编辑器中针对未解决的符号给出了很多警告.大多数是工作区中其他项目或第三方库的标题.

I have a workspace with multiple projects, which all compile with no problems. However, some of the projects are giving a lot of warnings in the editor about unresolved symbols, due to unresolved includes. Most are headers from other projects in the workspace, or third party libraries.

谷歌搜索表明这是索引器的问题,但是我没有找到有关如何解决它的任何连贯的解释-我假设我需要将这些库的路径添加到索引器的PATH中,但是我看不到这样做的任何选择(我正在使用Juno).

Googling suggests this is a problem with the indexer, but I haven't found any coherent explanations of how to fix it - I assume I need to add the paths to these libraries to the indexer's PATH, but I can't see any option to do that (I am using Juno).

任何人都可以向我解释如何配置CDT的索引器吗?

Can anyone please explain to me how to configure CDT's indexer?

我也无法解决在两个项目中包含针对STL标头的警告.一些STL标头已解决,但其他STL标头没有解决,并且两个项目之间的列表似乎并不相同(一个找到矢量和iostream之类的东西,但找不到sstream或字符串,另一个发现也没有iostream的东西)

I am also getting unresolved include warnings for STL headers in two projects. Some STL headers are resolved but others aren't, and the list doesn't seem to be the same between the two projects (one finds things like vector and iostream, but not sstream or string, the other doesn't find iostream either).

可能是相关的:这些是​​C ++项目,但是所有文件扩展名都是.c.我将GCC C编译器命令更改为"g ++"以对其进行编译,但我想我还需要对索引器设置进行一些处理以解决该问题?

Possibly relevant: these are C++ projects, but all the file extensions are .c. I changed the GCC C Compiler command to 'g++' to compile them, but I guess I also need to do something to the indexer settings to cope with it?

推荐答案

好,所以我现在解决了这个问题.

Ok, so I've now fixed this issue.

  1. 工作空间中其他项目的未解决的包含,第三方库通过添加其他项目作为引用来解决.我猜编译器知道在哪里寻找,因为我已将位置添加到包含"列表中,但索引器却没有(可能是因为蚀只处理了一次标头?)

  1. Unresolved includes from other projects in the workspace and third-party libraries was solved by adding the other projects as references. I guess the compiler knew where to look because I'd added the locations to the Includes list, but the indexer didn't (possibly due to eclipse only processing headers once?)

未解决的STL包含的问题已通过将所有实际上为C ++的.c文件更改为.cpp来修复.仅仅将compile命令更改为'g ++'显然不足以告诉索引器将该项目视为C ++.

Unresolved includes from STL I fixed by changing all my .c files that were actually C++ to .cpp. Just changing the compile command to 'g++' obviously wasn't enough to tell the indexer to treat the project as C++.

在1)的情况下,我需要先清理/重建引用项目的索引,以消除未解决的包含错误.

In the case of 1), I needed to clean/rebuild index of the referenced projects first to remove the unresolved include errors.

这篇关于Eclipse CDT索引器-如何解决未解决的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆