Command based programming problem

We are trying to use the new command-based system in C++. We are getting an error on build that we think might be related to the Command.h file. It is not in the commands directory but there is no way of knowing whether WIPLib actually includes this. None of the classes that eventually inherit Command are recognized.


Hi Tom,
This is a simple include path problem. Open WindRiver and right-click on your project, then choose “Properties”. Across the top of the next window, you will see a bunch of tabs, one of which is called “Paths”, click on it. In the middle of that window, you should see 3 entries in a table that all look like -I$(WIND_BASE)/target/h/… Click the “Add” button on the right, and in the new row, put -I$(WIND_BASE)/target/h/WPILib/Commands. This will add an automatic include path to your build system so files will be able to see “Command.h” and “Subsystem.h” etc.

Alternatively, you could #include those files explicitly by doing this in your source files:
#include “Commands/Command.h”
#include “Commands/Subsystem.h”

Hope that helps :smiley:

I appreciate the response, Grant. Although I haven’t tried your first suggestion, the include statements were present in the code and we still had the problem. Have you used the new command based sample template in C++? The line of code that is giving us an error was actually generated by the wizard.

Tom Thompson

FYI – I just gave a try at compiling the template/example CommandBasedRobotTemplate and it compiled fine for me.