WPILib Cookbook's Example Code Doesn't Work

I followed all the instructions for C++ up until page 30, and when I tried to build my project it doesn’t work. I’m sure I have the exact same code as is shown in the cookbook, and I get these errors.

C:/WindRiver/workspace/CommandBasedRobotTemplate_Cookbook/CommandBase.cpp:9: error: `Chassis*CommandBase::Chassis' is not a static member of `class CommandBase'
C:/WindRiver/workspace/CommandBasedRobotTemplate_Cookbook/CommandBase.cpp: In static member function `static void CommandBase::init()':
C:/WindRiver/workspace/CommandBasedRobotTemplate_Cookbook/CommandBase.cpp:13: error: `chassis' undeclared (first use this function)
C:/WindRiver/workspace/CommandBasedRobotTemplate_Cookbook/CommandBase.cpp:13: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\WindRiver\vxworks-6.3\host\x86-win32\bin\make.exe: *** [CommandBasedRobotTemplate_partialImage/Debug/Objects/CommandBasedRobotTemplate_Cookbook/CommandBase.o] Error 1
Build Failed in Project 'CommandBasedRobotTemplate_Cookbook' (Process Exit Value was 2):   2013-01-20 18:01:32   (Elapsed Time: 00:01)

Disclaimer: I don’t have any real experience with command/subsystem programming, so I might not be a good person to take advice from. That said…

Double-check page 27. Does your code match? Specifically, did you leave out any spaces, or get a word miscapitalized?

If you are using the cookbook from 2012, there are a few things that changed. I think http://wpilib.screenstepslive.com/s/3120 will eventually have all the content of the old documentation, but until then you have to pick through the old examples and watch for changes.

In your case it sounds like you have a chassis subsystem. The old way of handling that was to put all subsystems into the CommandBase class so all commands have easy access to subsystems. That’s not a good design.

The 2013 approach is better. Put your subsystems into the Robot class and in your commands refer to Robot::chassis. If you use Robot Builder it follows this convention.

Since you are new to the command-based robot approach, you definitely should experiment with Robot Builder and carefully read the code it generates. It’s quite good. Even if you decide not to use Robot Builder, you’ll probably adopt a lot of what you learn from reading that code.

I think somewhere you have “Chassis” written as “chassis”… maybe. Thats what I can gather off your build console. I’d have to see your source code.
(We do not use subsystems and commands for our robots, just FYI. I find it to be messy-disgusting layers of OOP and abstractions… so if it is a command-based issue, I dont know what it would be)

Yes, the code matches exactly (except for the tabs, those were omitted for some reason when I copy/pasted the code into WindRiver)

I do have a Chassis subsystem; I’ll look into the 2013 documentation instead now. Thanks.