Building a class hiearchy using AccelStepper as member

Hi

I’m wrestling to get away from link errors when referencing to AccelStepper functions used in another class.

I created a SLDR_wagon class in which I implemented an AccelStepper motor.

Everywhere I call accelstepper functions I’ve got this kind of errors:
SLDR_wagon\SLDR_wagon.cpp.o: In function …
"undefined reference to AccelStepper::run()

In the ‘verbose’ compiler output I can not discover any reference to AccelStepper elements or include files which couldn’t be found. Looks like AccelStepper is not included in the compilation of the sketch.

Someone any idea why this is failing…?!

Below some relevant code to show how I set things up.

Already tried to add #include <AccelStepper.h> in every file involved (stepper.ino, SldrWagon.cpp, SldrWagon.h) but that doesn’t seems to be the solution.

Fred.

///---- slider.ino -----\\\
// here not much more like:

#include <Arduino.h>
#include <SLDR_wagon.h>

SldrWagon slider;

void setup()
{  
  Serial.begin( 9600 );
}

void loop() {
 slider.setSpeed( 1000.0 );
}

///---- SldrWagon.h>  -----\\\

#include <Arduino.h>
#include <AccelStepper.h>

//contains
class SldrWagon  : public AccelStepper {
   public: 
              SldrWagon( void );
	 void setSpeed(void);
//etc
/etc
}


///---- SldrWagon.cpp>  -----\\\
#include <Arduino.h>
#include <AccelStepper.h>
#include <SldrWagon.h> 


SldrWagon::SldrWagon( void )  { 
  AccelStepper::AccelStepper( 2, _STEPPER_STEP_PIN_, _STEPPER_DIR_PIN_);
  setAccelerateDist( 50 ) ;   // not posted here
  _initStepper();                //  not posted here
  return;
}

void SldrWagon::setSpeed( const float speed ) {
   AccelStepper::setSpeed( speed );
   return;   
}


--------------------------  (erros listed when building the sketch. just a subset. I left a lot similar lines out )
C:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino -IC:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\variants\standard -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\LCD_Keypad C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\Slider.cpp -o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\Slider.cpp.o 
C:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino -IC:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\variants\standard -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\LCD_Keypad -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon\utility C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon\SLDR_wagon.cpp -o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\SLDR_wagon\SLDR_wagon.cpp.o 
C:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino -IC:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\variants\standard -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\LCD_Keypad -IC:\Users\fred\Dropbox\data\Arduino - Projects\libraries\LCD_Keypad\utility C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\LCD_Keypad\LCD_keypad.cpp -o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\LCD_Keypad\LCD_keypad.cpp.o 
C:\Arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\tools\avr\bin\avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\Slider.cpp.elf C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\Slider.cpp.o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\SLDR_wagon\SLDR_wagon.cpp.o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\LCD_Keypad\LCD_keypad.cpp.o C:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp\core.a -LC:\Users\fred\AppData\Local\Temp\build7297760677170099481.tmp -lm 
SLDR_wagon\SLDR_wagon.cpp.o: In function `SldrWagon::_setSpeed(float, unsigned char)':
C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon/SLDR_wagon.cpp:412: undefined reference to `AccelStepper::setSpeed(float)'
SLDR_wagon\SLDR_wagon.cpp.o: In function `SldrWagon::_singleStep()':
C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon/SLDR_wagon.cpp:352: undefined reference to `AccelStepper::move(long)'
C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon/SLDR_wagon.cpp:353: undefined reference to `AccelStepper::run()'
SLDR_wagon\SLDR_wagon.cpp.o: In function `SldrWagon':
C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon/SLDR_wagon.cpp:124: undefined reference to `AccelStepper::AccelStepper(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, bool)'
C:\Users\fred\Dropbox\data\Arduino - Projects\libraries\SLDR_wagon/SLDR_wagon.cpp:125: undefined reference to `AccelStepper::AccelStepper(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, bool)'
SLDR_wagon\SLDR_wagon.cpp.o:(.rodata._ZTV9SldrWagon+0x4): undefined reference to `AccelStepper::disableOutputs()'
SLDR_wagon\SLDR_wagon.cpp.o:(.rodata._ZTV9SldrWagon+0x6): undefined reference to `AccelStepper::enableOutputs()'
SLDR_wagon\SLDR_wagon.cpp.o:(.rodata._ZTV9SldrWagon+0x8): undefined reference to `AccelStepper::setOutputPins(unsigned char)'
SLDR_wagon\SLDR_wagon.cpp.o:(.rodata._ZTV9SldrWagon+0xa): undefined reference to `AccelStepper::step(long)'
SLDR_wagon\SLDR_wagon.cpp.o:(.rodata._ZTV9SldrWagon+0xc): undefined reference to `AccelStepper::step0(long)'
SLDR_wagon\SLDR_wagon.cpp.o:(.rodata._ZTV9SldrWagon+0xe): undefined reference to `AccelStepper::step1(long)'

The errors are gone. solved by adding #include <AccelStepper.h> in the sketch file

I do not know why though. accelstepper is not used directly here but only in the library of another class.