开发者

Eclipse C++ include error: no such file or directory

I've loaded a C++ project into Eclipse (Europa) and I'm familiarizing myself with the CDT interface.

There is one particularly annoying error message for the following line:

#include "somedir/somefile.h"

somedir/somefile.h: No such file or directory

The include file exists in "/opt/local/project/include/somedir/somefile.h".

Under Project > Properties > C/C++ General > Paths and Symbols > Includes, I've already added the include directory "/opt/local/project/include".

However, this does not seem to solve the issue.

Does anyone know how to deal with this error? Thanks.

Edi开发者_StackOverflow中文版t: Solved the problem. Turns out that it was a simple issue. I had to "refresh" all the projects in the workspace.


Why such an old version? Newer versions of the Eclipse CDT have made vast improvements.

This is a really obvious question, but under Project > Properties > C/C++ General > Paths and Symbols > Includes (at least in the current CDT), there are separate categories for each language (assembly, C, and C++). Did you make sure to add /opt/local/project/include under both C and C++ (if appropriate)?

Alternatively, if your project is built using Make, then simply building your project from within Eclipse will often let Eclipse auto-detect include directories using Make's output, without your having to set the include paths yourself.

If the paths are all set up correctly, then the standard fix for indexing-related problems is to right-click on your project, choose Index, and choose Rebuild.


Right Click on project -> Index -> Freshen All Files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜