Excluding from Build
in Visual Studio and Eclipse Environments

This page explains how to "Exclude from Build" in a project containing two or more files with main() function definition. This example is relevant to Assignment 5 and subsequent assignments.

 

In assignment 5, you will be working with three .cpp files containing main() function.  These are PlotDev.cpp and PlotODEtest.cpp (provided by the professor) and SystemSolve.cpp (which you will create yourself). Here is what you'll be doing:

1. Follow the Assignment 5 instructions for creating a project, include PlotDev.cpp, and make sure you get an empty graphics window, as here.

2. Implement PlotData class, uncomment a block of code in PlotDev.cpp. Running this program will give you a graphics display here.

3. Include PlotODEtest.cpp into a project. PlotODEtest.cpp is a program that uses PlotData class for plotting the solution of an ODE.  Running th program will give you a graphics display similar to the one here.

Note that since both PlotDev.cpp and PlotODEtest.cpp programs contain main() function, you will have to "Exclude From Build" one of them.  In Visual Studio, right-click on the file to be excluded from build, choose Properties, Configuration Properties -> General -> Excluded From Build -> Yes -> OK.

In Eclipse, right-click on the file to be excluded from build, choose Properties, C/C++ Build -> Excluded from build -> OK.

4. Create SystemSolve.cpp, which is a program that uses PlotData class for plotting the solution of an ODE specified by a user in the command line. In order to compile, a project with SystemSolve.cpp included, you need to exclude PlotDev.cpp and PlotODEtest.cpp from build. A sample window can be found here.

horizontal rule

Igor Yanovsky