Eclipse Method could not be resolved in a simple program C++

后端 未结 4 1629
别跟我提以往
别跟我提以往 2020-12-19 06:43

I have an issue with Eclipse Indigo complaining that methods of a class couldn\'t be resolved, but compiling anyway and working correctly (AFAIK). It\'s a very simple progr

4条回答
  •  我在风中等你
    2020-12-19 07:35

    This could be an indexing issue related to external #include headers not found. Follow the steps below and see if it helps:

    1. Go to each of your custom #include (e.g. "cute.h") and press F3 (i.e. "Show declaration"); see if it's able to access that file or not; if not copy those files on some notepad
    2. If the file is not accessible, then locate it paths in your directory structure; e.g. "cute.h" and "a.h" are located at, "C://Eclipse/MyWork/Workspace/Project/include_1" and "ide_listener.h" is located at,"C://Eclipse/MyWork/Workspace/Project/include_2", then copy both the folder paths on some notepad
    3. Inside Eclipse go to Project -> Properties -> C/C++ General -> Paths and Sybmols; you will see several tabs as Includes, Sybmols, Library Paths ...
    4. Click Library Paths -> Add -> Workspace... -> and press OK
    5. Let the indexer rebuild; now again follow the step (1); hopefully the files should be accessible
    6. For future safety for larger files, go to Window -> Preferences -> C/C++ -> Editor -> Scalability -> "Enable scalability mode when ..." and set the number of lines to some big number such as 500000 and press "OK";

    The last step is needed, because when your file grows in line number and if exceeds the above number then eclipse will stop showing definitions for some "scalability" reasons, even though it would have indexed.

提交回复
热议问题