Quote:
Originally Posted by Straberrie
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
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.