RyZeRun
October 31, 2016, 11:28am
1
I created a WPILib example file, “Getting Started”. This is my code:
#include "WPILib.h"
class Robot: public IterativeRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
LiveWindow *lw;
int autoLoopCounter;
public:
Robot() :
myRobot(0, 1), // these must be initialized in the same order
stick(0), // as they are declared above.
lw(LiveWindow::GetInstance()),
autoLoopCounter(0)
{
myRobot.SetExpiration(0.1);
}
private:
void AutonomousInit()
{
autoLoopCounter = 0;
}
void AutonomousPeriodic()
{
if(autoLoopCounter < 100) //Check if we've completed 100 loops (approximately 2 seconds)
{
myRobot.Drive(-0.5, 0.0); // drive forwards half speed
autoLoopCounter++;
} else {
myRobot.Drive(0.0, 0.0); // stop robot
}
}
void TeleopInit()
{
}
void TeleopPeriodic()
{
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
}
void TestPeriodic()
{
lw->Run();
}
};
START_ROBOT_CLASS(Robot)
I get five errors:
Program “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl” not found in PATH
The type ‘Joystick’ must implement the inherited pure virtual method ‘GenericHID::GetPOV’ In line 7
The type ‘Joystick’ must implement the inherited pure virtual method ‘GenericHID::GetRawAxis’ In line 7
The type ‘Joystick’ must implement the inherited pure virtual method ‘GenericHID::GetRawButton’ In line 7
The type ‘RobotDrive’ must implement the inherited pure virtual method ‘MotorSafety::GetDescription’ In line 6
Also, ‘START_ROBOT_CLASS(Robot)’ has a syntax error.
How can I fix these errors?
Hi,
Hopefully this will help:
“Program “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl” not found in PATH”
This indicates that the development environment is probably not setup. If you are going to use Visual Studio you may wish to look at this thread: https://www.chiefdelphi.com/forums/showthread.php?t=149795&highlight=visual+studio
If you are just starting out with C++, I would recommend starting with the setup instructions described here: https://wpilib.screenstepslive.com/s/4485/m/13810/c/57252
My guess is that the rest of the errors you are seeing are related to include paths that need to be set for the WPILIB include directories.
I’m at my day job right now, but I can add more detail when I get home this evening. Hopefully the information I gave you above can help get you started.
Matt
mdballard:
Hi,
Hopefully this will help:
“Program “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl” not found in PATH”
This indicates that the development environment is probably not setup. If you are going to use Visual Studio you may wish to look at this thread: https://www.chiefdelphi.com/forums/showthread.php?t=149795&highlight=visual+studio
If you are just starting out with C++, I would recommend starting with the setup instructions described here: https://wpilib.screenstepslive.com/s/4485/m/13810/c/57252
My guess is that the rest of the errors you are seeing are related to include paths that need to be set for the WPILIB include directories.
I’m at my day job right now, but I can add more detail when I get home this evening. Hopefully the information I gave you above can help get you started.
Matt
I’m using Eclipse Mars 2, and have installed the toolchain, plugins, etc. Everything’s all set up. I double-checked the C++ setup.
Try closing Eclipse, deleting C:\Users<You>\wpilib, then starting Eclipse again (wait for it to recreate the folder)