View Single Post
  #1   Spotlight this post!  
Unread 02-09-2015, 09:20 PM
Saberbot's Avatar
Saberbot Saberbot is offline
Ask me about Glentite™
AKA: David Ingraham
FRC #4146 (Saguaro Sabercat Robotics)
Team Role: College Student
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Arizona
Posts: 109
Saberbot is just really niceSaberbot is just really niceSaberbot is just really niceSaberbot is just really nice
RobotBuilder not including headers for Default Commands

We were having trouble getting our RobotBuilder generated code to compile. Whenever we set a default command for a subsystem, we would get an error:
Code:
void Elevator::InitDefaultCommand() {
	// Set the default command for a subsystem here.
	//setDefaultCommand(new MySpecialCommand());
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
	SetDefaultCommand(new ElevatorToBottom());

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
}
Code:
Info: Internal Builder is used for build
arm-frc-linux-gnueabi-g++ -std=c++1y -I/Users/davidingraham/wpilib/cpp/current/include "-I\\$\\{workspace_loc:/2015RobotBuilder/src}" -O0 -g3 -Wall -c -fmessage-length=0 -o src/Subsystems/Elevator.o ../src/Subsystems/Elevator.cpp 
../src/Subsystems/Elevator.cpp: In member function 'virtual void Elevator::InitDefaultCommand()':
../src/Subsystems/Elevator.cpp:62:24: error: expected type-specifier before 'ElevatorToBottom'
  SetDefaultCommand(new ElevatorToBottom());
We were able to fix this by including the header file for the command we wished to set as the default:
Code:
#include "../Commands/ElevatorToBottom.h"
at the top of the "Subsystems/Elevator.cpp" source file.

It seems that RobotBuilder is not automatically including the the header file for the default command in the <subsystem>.cpp file. Is this a bug, or are we expected to add this manually?
__________________

Last edited by Saberbot : 02-10-2015 at 02:04 AM. Reason: clarity
Reply With Quote