Go to Post I wonder how many games we could come up with that are not the one for FRC 2008. - AndrewN [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-12-2015, 15:56
Yanglin501st's Avatar
Yanglin501st Yanglin501st is offline
Registered User
AKA: Yang Lin
FRC #3044 (OxBe4)
Team Role: Programmer
 
Join Date: Oct 2014
Rookie Year: 2008
Location: New York
Posts: 3
Yanglin501st is an unknown quantity at this point
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();
	}
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:"
Reply With Quote
  #2   Spotlight this post!  
Unread 20-12-2015, 16:06
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 322
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Problem with WPI Library

Quote:
Originally Posted by Yanglin501st View Post
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();
	}
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
Reply With Quote
  #3   Spotlight this post!  
Unread 20-12-2015, 18:09
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-12-2015, 22:43
Yanglin501st's Avatar
Yanglin501st Yanglin501st is offline
Registered User
AKA: Yang Lin
FRC #3044 (OxBe4)
Team Role: Programmer
 
Join Date: Oct 2014
Rookie Year: 2008
Location: New York
Posts: 3
Yanglin501st is an unknown quantity at this point
Re: Problem with WPI Library

Quote:
Originally Posted by euhlmann View Post
Try rebuilding the C++ Index. Right click on your project > index > rebuild
^I tried rebuilding the C++ Index like you said and nothing changed.

Quote:
Originally Posted by ozrien View Post
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.
^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.

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();
	}
};
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!
Reply With Quote
  #5   Spotlight this post!  
Unread 21-12-2015, 23:16
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 21-12-2015, 23:43
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Problem with WPI Library

Quote:
Originally Posted by Yanglin501st View Post
This was what it displayed:
"Multiple markers at this line
- Line breakpoint: Robot.cpp [line: 8]
- Member 'lw' was not initialized in this
constructor"
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)
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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