Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   RobotBuilder not including headers for Default Commands (http://www.chiefdelphi.com/forums/showthread.php?t=134269)

Saberbot 02-09-2015 09:20 PM

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?

JohnSmooth42 02-10-2015 10:44 PM

Re: RobotBuilder not including headers for Default Commands
 
In my(pretty limited) experience with the software, it can be pretty buggy.

dravis 02-17-2015 09:52 AM

Re: RobotBuilder not including headers for Default Commands
 
I had the same problem. Had no problem with default command for one subsystem, but another I had to manually add the header file for another or it wouldn't build.


All times are GMT -5. The time now is 10:09 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi