Community
Participate
Working Groups
The organize includes feature apparently always assumes that preprocessor include paths are external include paths. Steps to reproduce: 1) Add the following include path to a C++ project: go to Project Properties -> C/C++ Build -> Settings -> Tool Settings tab -> G++ Compiler -> Includes -> Include paths -> Add -> click on Workspace button -> select project root folder. 2) Use the organize includes feature with default settings for the following minimal test.cpp file: *** FILE: test.h *** class TestClass { }; *** FILE: test.cpp *** void f() { TestClass test; } 3) Observe behavior: Expected: test.h is included as partner header, using #include "test.h" Actual: test.h is included as system header, using #include <test.h> The problem is that organize includes classifies test.h as system header here instead of as partner header. Thus, I can't include my headers by using a project-root relative include path. 4) Proposed solution: Only classify header files as system headers if they're not contained within the project itself, independent of any include paths.
Confirmed. Interestingly, if the path is added via Project Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc. -> Entries -> GNU C++ -> CDT User Setting Entries (as a Workspace Path), the generated include is of the form "test.h".
Created attachment 267996 [details] Example Eclipse C++ project demonstrating the problem This problem still exists and is very annoying! I added a test project that reproduces the problem. It has the following classes: - TestIncludeeA - Level1Folder/TestIncludeeB - Path/To/Class/Deepdownbelow/TestIncluder The TestIncluder includes the TestIncludeeA and B, which are several folders up in the project tree. The includes generated by eclipse look like the following: #include "../../../../Level1Folder/TestIncludeeB.h" #include "../../../../TestIncludeeA.h" I hope this helps fixing the problem.