Adding New Folders to C Projects #221
-
Currently using 2022-09 (4.25.0) / CDT 10.7.1 / macOS 10.15.7 Seeking clarification: This has confused me forever. Neither docs, experiments, nor Google have been able to shed light. Whenever I add a new folder within the source code project, I have to go into project Properties > C/C++ Build > Tool Settings > GCC C Compiiler > Includes and manually add the full folder path into the list. I have tried use the project contextual menu to add "Source Folder," but that doesn't even add the folder where I want it. Regardless of the level of parent folder I select to add a folder to, the Source Folder option always puts the folder at the root of the project. So, obviously that has some special purpose. It just seems to me that adding a folder, just like adding a new header file, should be something that is added to the project automatically. Is this manual intervention for folders really required, or have I somehow missed configuring something correctly? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
I think there may be some terminology confusion here, not quite sure. A "source folder" in CDT is a folder that the sources are in, these are folders that are indexed, including for build, etc. They can be configured in the project properties These source folders appear at the top level all the time. Includes need to be somewhat manually managed if you want that folder to be explicitly listed as a What I think you want to enter in the Includes tab is something like Here is a screenshot showing all of it in one place. Hopefully the above either answers your question, or provides the starting point to ask me a clarifying question. |
Beta Was this translation helpful? Give feedback.
-
OH — one more related thing to the Includes paths — whenever I copy a whole project (all the hidden project settings files included) to another computer (same OS, same version of Eclipse CDT) whether manually or from a version control system, I have to manually re-enter every single folder in the whole project into the Includes list (quite a chore for big projects). Given that I am using workspace relative paths, and essentially everything else in the project seems to move, I am expecting that the Includes list would too. Is that the expected behavior, or is something not set correctly? Thx. |
Beta Was this translation helpful? Give feedback.
I think there may be some terminology confusion here, not quite sure.
A "source folder" in CDT is a folder that the sources are in, these are folders that are indexed, including for build, etc.
They can be configured in the project properties
These source folders appear at the top level all the time.
Includes need to be somewhat manually managed if you want that folder to be explicitly listed as a
-I
folder. This is done where you are describing, in the "Includes" tab under C/C++ BuildWhat I think you want to enter in the Includes tab is something like
"${workspace_loc:/${ProjName}/src/inc}"
. The magic bits should be filled in automatically by pressing the Workspace button when adding a …