View Single Post
  #3   Spotlight this post!  
Unread 18-12-2008, 14:50
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Pointers and Tank Drive?

Quote:
Originally Posted by Straberrie View Post
C:/WindRiver/workspace/SimpleTemplate/MyRobot.cpp:31: error: `stick1' undeclared (first use this function)
This means that within MyRobot.cpp, the compiler doesn't know what stick is.

If you copy/pasted the example code that is on page 14, it will not work and you will get this exact error. The reason is that stick1 is never declared (hence the error). Look at the 3rd line of code in the sample code
Code:
Joystick stick(1);
It looks like there was a mistake and they forgot to add the declaration for the correct sticks (maybe it started as arcade drive?). Based on the usage, try replacing that line with declarations for stick1 (and stick2 which should also be throwing an error) and this error should go away.
Code:
Joystick stick1(1);
Joystick stick2(2);
Your issue isn't with pointers, but rather with undeclared variables. If you wanted to use pointers, you can use 1075guy's suggestion as a reference point.