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.


class Robot: public IterativeRobot
{
public:
	LiveWindow *lw;
	CANTalon Motor(1);
	void RobotInit()
	{
		lw = LiveWindow::GetInstance();
	}

When I hovered over the error on “class Robot: public IterativeRobot”, it displayed this:
“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:”

Try rebuilding the C++ Index. Right click on your project > index > rebuild

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/control-system/motor-control/talon-srx.html#product_tabs_technical_resources
…and since you are using CANTalons, you probably should look through the manual for help and examples.

^I tried rebuilding the C++ Index like you said and nothing changed.

^I went through the reference manual and tried to mimic the example code provided. As a result, it fixed the current error but I now have yellow squiggly underline under a part of my code and I’m not sure what it means.


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();
	}
};

This was what it displayed:
“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!

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.

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.

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)