Go to Post Teams should make it a practice to protect their Victors (all the electronics, really) from the mechanical folks, with their saws and files and stone axes... - DonRotolo [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 Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 09-12-2010, 17:54
ehlochbr ehlochbr is offline
Registered User
FRC #2990
 
Join Date: Nov 2010
Location: Salem, OR
Posts: 37
ehlochbr is an unknown quantity at this point
Re: Error: within this context

I really appreciate both of your replies, but making the corrections you suggested has led me to another problem.

Code:
class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	Gamepad controller;
	AxisCamera& camera;
	
public:
	RobotDemo(void):
		myRobot(10, 9, 2, 1),	
		controller(1)
	{                                     <-------------------------ERROR HERE
		GetWatchdog().SetExpiration(0.1);
	
		camera = AxisCamera::GetInstance();  <--------ERROR HERE
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.
Reply With Quote
  #2   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
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
What's this number 80 in error math? K.Porter Programming 3 25-01-2007 18:28
Glitches Eliminated using Interrupt Context Saving, BUT ... mluckham Programming 22 09-01-2007 17:19
Trying to follow C18 interrupt context code... dcbrown Programming 5 21-12-2006 09:01
What is this error message? chantilly_team Programming 3 22-01-2005 10:09
Explain this link error? Larry Barello Programming 1 16-01-2004 11:06


All times are GMT -5. The time now is 13:26.

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