Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Completely exclude certain directories from Eclipse CDT project

I am working a C++ codebase that is built & run outside Eclipse.

I made an Eclipse project out of it where I just use Eclipse for browsing/editing the code.

However, I can't figure out how to completely exclude certain directories like build/ from it completely. They should be excluded not only during building but also during "Refresh workspace" which seems to get triggered so often. To give an example, my workspace is

d:\workspace

It has directories like

source/
build/
..

During startup, Eclipse picks up all directories inside the workspace automatically. However, I would like Eclipse to exclude build/ completely.

My code is on a remote machine, so "Refresh workspace" slows things down.

like image 689
user674669 Avatar asked Sep 21 '11 11:09

user674669


2 Answers

You can do it by adding Resource filters. Add Exclude All resource filter type to root folder of your project. See also this answer.

like image 135
ks1322 Avatar answered Nov 12 '22 12:11

ks1322


I am very firmly of the opinion that all answers for questions like this need to include the version in which they have been tested-- because, like most things in Eclipse, this has gradually changed. In Eclipse Neon.3 (4.6.3), you can do this more directly.

NOTE: The excluded directory will no longer show up in the Project Explorer tree AT ALL.
If this will be a problem, select a different technique!


Otherwise, proceed as follows:

1. Left-click the project root in the Project Explorer tree to ensure proper context (you "shouldn't need to do this"-- like a lot of things in Eclipse).
2. Right-click the folder you wish to exclude in the Project Explorer tree.
3. Select the "Resource Configurations..." submenu.
4. Select "Exclude from Build".
5. Right-click the project root in Project Explorer.
6. Select the "Index" submenu.
7. Select "Rebuild".

If you were trying to do this because you were getting duplicate symbols, verify this has fixed your problem:

1. Open a file referencing the symbol that was getting duplicate definitions.
2. Left click the actual characters of the actual name in the actual code.
3. Press F3.
4. Verify that you either go immediately to the declaration you consider
correct, you see a list including only that entry and its ancestors.
5. Upvote this answer, and reply if you find that it works with a newer version, please.

like image 4
breakpoint Avatar answered Nov 12 '22 12:11

breakpoint