Eclipse CDT Error: "Type can not be resolved"

Hi all,

We've got a legacy c++ system under a linux server and using samba to share the code..I am then using Eclipse CDT to modify the system with cygwin gcc under window xp (The linux server have no eclipse and graphic interface)......In the existing code, there is a complext folder structure, and the head files and source c++ files are located in many different sub-folders...


After I create a c++ project using the option "makefile project with existing code", I encounter a strange problem:

In A.h, there are some self-defined data structures. In B.h, the data structures can not be resolved but in B.h there is a line of code saying #include "A.h" (when I tried to press F3 on the line of code, I could get the file A.h, which means Eclipse knows/indexes A.h).

In addition, the legacy c++ system has been compiled succeessfully under linux using make. Cygwin is working OK.

SO the problem is why the data structures can not be resolved on Eclipse?

My Eclipse version:
Version: Indigo Release
Build id: 20110615-0604

Thanks
Xiong
I've had similar problems. Have you tried closing and reopening eclipse? The parser seems to run into problems sometimes, but in general it should work with almost anything you throw at it.

For example, this is correctly recognized as a function declaration:
1
2
#define AL_FUNC(_type,_name,_args) extern _type _name _args
AL_FUNC(int,foo,(int));


Also, if it's a very large project it might take a few minutes - the parser is a bit slow sometimes. Also, save all your files after including something. (The ones you actually changed, obviously).
Last edited on
Is your headers folder a "source folder" or a subdirectory of a "source folder"? You can make it so by going to File->New...->Source Folder and selecting your headers folder there. Then hopefully the Indexer will scan them.
Incidentally if your project uses make then it might be better creating a new Makefile project. First copy your source into a folder in the Workspace, then create a new Makefile project giving a name identical to the name of the folder that your project is in. It will automatically find all the files.
I am experiencing the same error even after taking an existing makefile project, and copying creating the new makefile project as Galik suggests. However, I had to add includes using project properties after the fact. The headers are found now but the items such as std::string, and std::map as well as internally defined objects are still showing "Type '...' could not be resolved" for example: "Type 'string' could not be resolved" on a line like

std::string name;

My Eclipse Version:

Eclipse IDE for JavaScript Web Developers.

Version: Indigo Release
Build id: 20110615-0604


I am seeing a common thread here in that both Xiong Deng and I are using the same eclipse version.
Last edited on
Topic archived. No new replies allowed.