I'm not familiar with eclipse. I have a question as this topic title. The scenario is that I want create a sub-folder "test" (for unit test) in folder src. But after the creation of folder "test", eclipse will automatically add this "test" folder and its content to current project. This leads to an error of multiple definition of "main" function because under "test" folder there is also a cpp file that contains main function. What I want is that put the "test" folder in src folder but this folder is not belong to current project, this means that when I compile current project the files under "test" won't be compiled (There is another test project do this). Anybody know? Thank you in advance!
Asked
Active
Viewed 2,910 times
2
-
1If you develop in C/C++ under Eclipse, you should explicitly mention that in your question. Most readers of this question will try to answer under the assumption you are talking about Java if you only mention Eclipse. – Bananeweizen Sep 26 '12 at 16:23
1 Answers
2
By default Eclipse adds everything under the source folder as a source, but this can be changed in the project property settings. Right click on the project, select "properties", then make changes in the java build path to add an exclusion filter.
Update:
To remove the folder from the project view, set a filter in the view menu:

Fredrik
- 10,626
- 6
- 45
- 81
-
1Although my environment is eclipse with CDT which has some difference with your sample, your answer gives me a clue. I found the exclusion option in my environment is C/C++ General->Paths and Symbols->Source Location->Edit Filter. Thank you very much! – Kery Sep 26 '12 at 08:03
-
I found another problem. Your solution solved the compiling problem, but the excluded folder is still visible in the project explorer panel. How to remove it from the project explorer? – Kery Sep 26 '12 at 08:32
-
Update the answer. There is a filter setting that filters the files you see in the view. The triangle in top right corner opens the menu for the view – Fredrik Sep 26 '12 at 10:52
-
Yes, I found it. But in the filter setting there are only predefined filters and I can't find where to add customer filters. But I found an answer in this website that solved my problem (url is http://stackoverflow.com/questions/6137848/eclipse-how-to-hide-custom-files-in-project-explorer). Anyway, thank you very much! – Kery Sep 27 '12 at 04:28