View Single Post
  #8   Spotlight this post!  
Unread 09-12-2010, 18:01
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Error: within this context

Quote:
Originally Posted by ehlochbr View Post
I really appreciate both of your replies, but making the corrections you suggested has led me to another problem.

The first error says "uninitialized reference". How do I initialize it?
The second error gets me back to where I started. It says "error within this context".

This feels like one step forward then two steps back. Thanks for your help.
You need to initialize all non pointer members before the body (and especially references, they only have one life)

try this:
Code:
class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	Gamepad controller;
	AxisCamera& camera;
	
public:
	RobotDemo(void):
		myRobot(10, 9, 2, 1),	
		controller(1),
camera(AxisCamera::GetInstance())
	{                                    
		GetWatchdog().SetExpiration(0.1);
Also, "error within this context" is part of a larger error, open the build console and find the red lines to find the rest of the message. many messages are 2 or more parts.
Ex (bold is error in code)
file.cpp: In constructor `ZomBDashboardPacketSender::ZomBDashboardPacketSen der()':
file.cpp:301: error: uninitialized reference member `ZomBDashboardPacketSender::hp'
WPILib/Dashboard.h:58: error: `void Dashboard::operator=(const Dashboard&)' is private
file.cpp:302: error: within this context
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib

Last edited by byteit101 : 09-12-2010 at 18:08. Reason: expanding
Reply With Quote