|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Problem with WPI Library
Hello, a few days ago I downloaded the the WPI library into my eclipse and tried initializing a CANTalon. However, I got an error and I'm unsure of what it means and how to fix it.
Code:
class Robot: public IterativeRobot
{
public:
LiveWindow *lw;
CANTalon Motor(1);
void RobotInit()
{
lw = LiveWindow::GetInstance();
}
"Multiple markers at this line - candidates are: - no matching function for call to 'CANTalon::CANTalon()' - 'Robot::Robot()' is implicitly deleted because the default definition would be ill-formed:" |
|
#2
|
||||
|
||||
|
Re: Problem with WPI Library
Quote:
|
|
#3
|
||||
|
||||
|
Re: Problem with WPI Library
Also I'm not sure that is valid C++ (unless C++11 allows constructor params to be specified like that now and I didn't know).
Try to follow the example in the Talon SRX Software Reference manual section 3.4. http://www.ctr-electronics.com/contr...ical_resources ...and since you are using CANTalons, you probably should look through the manual for help and examples. |
|
#4
|
||||
|
||||
|
Re: Problem with WPI Library
Quote:
Quote:
Code:
class Robot: public IterativeRobot
{
CANTalon motor;
Joystick joy;
LiveWindow *lw;
public:
Robot () : motor(1),
joy(1)
{
}
void RobotInit()
{
lw = LiveWindow::GetInstance();
}
void TeleopPeriodic()
{
double leftAxis = joy.GetY(Joystick::kLeftHand);
motor.Set(leftAxis);
}
void TestPeriodic()
{
lw->Run();
}
};
"Multiple markers at this line - Line breakpoint: Robot.cpp [line: 8] - Member 'lw' was not initialized in this constructor" Thanks for the help so far, I've only programmed Java for a year and I'm still trying to understand C++ for this year's robot! |
|
#5
|
||||
|
||||
|
Re: Problem with WPI Library
euhlmann wasn't wrong, it's a good idea to reindex when creating a new project so eclipse IDE knows to look at the latest WPILIB headers for IDE features that require it. Sometimes you will get parser errors because the index'd info is stale, but they look like real compiler-errors (red lines).
Yellow lines are warnings, red lines are errors. EclipseCDT sometimes keep old errors/warnings around after you fix them. Once in a while I will go the project explorer, expand Binaries, and delete FRCUserProgram (this is the binary you are building). Then select all the warning and errors in the Problem tab and delete them. Then full build the project. This will cleanly update the errors/warnings. If FRCUserProgram comes back in the project explorer, then you're program built successfully. http://www.chiefdelphi.com/forums/sh...63&postcount=5 The Console window also shows latest error output from the compiler, this streams the actual output of the compiler. The problems tab is the IDE's attempt to parse the output of the last build attempt (but it tends to forgot to clear sometimes). Your latest looks good, compiles on my side. |
|
#6
|
|||
|
|||
|
Re: Problem with WPI Library
The second bullet here is a warning. When you use an an initializer list like this, the IDE expects you to initialize all of the members of the class. The compiler is telling you that you are not initializing the LiveWindow pointer. You can either ignore this warning or initialize the pointer to null (you should not initialize it using LiveWindow::GetInstance, that call has to stay in RobotInit)
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|