How to exclude a source file from being build in eclipse (C++)?

c++, eclipse, unit-testing

Solution

I ran into a similar problem.

The C/C++ perspective of Eclipse Luna (4.4) is missing the contextual menu "Exclude from build".

I solve my problem by using the java perpective:

- Window -> Open Perspective -> Other... -> Java(default)

- Navigate to the file/folder you want to exclude

- Right Click -> Resource -> Exclude from build

Then you can switch back to the C/C++ CDT perspective

Problem

I am trying to follow some insane complicated steps in order to be able to create C++ unit-tests for C++ code in eclipse (I am utterly new to eclipse). These steps state to exclude some source files from using in the built - which makes sense to me. However, in my eclipse I do not see any `Exclude from built` option when right-clicking on the source file. Also, neither this answer nor this answer do work, as I do not see the mentioned options in the list of things when I right-click on the source file. So how to exclude a source file from a built? P.S. The Version of eclipse seems to be Luna 4.4.0. (Or, even better: If anyone knows an easier way to set up eclipse with ANY unit-testing framework in a SIMPLE way,- or knows a different Linux framework to start developing C++ projects with unit-testing right away without trying to set up things in unknown and complicated ways for weeks before starting to actually code something - ideas are VERY VERY welcome...)

Original source

Related problems