Include libraries into own Library

Hi. I am upto writing my own library for servo control. Now i am stuck at the point where i want to include other library into mine. At the moment just the simple Metro.h later on i want to merge everything with Servo.h — think i can do it myself if i understand how to include libraries into libraries.

have the easedServo.h file:

  easedServo.h - Library for eased servo movements
  Created by Markus Kerschkewicz, March 13, 2012.

#ifndef easedServo_h
#define easedServo_h

#include "Arduino.h"
#include "../Metro/Metro.h"

class easedServo
    easedServo(int MAX_POS, int MIN_POS, int filter);
    void givePos(int mode);
    void moveServo();
    float smoothed_pos;
    float pos;
    float _MIN_POS;
    float _MAX_POS;
    boolean _generate;
    float _filter;
    int _duration;
    Metro metro_interval;


getting error:

Arduino/libraries/easedServo/easedServo.cpp: In constructor 'easedServo::easedServo(int, int, int)':
Arduino/libraries/easedServo/easedServo.cpp:10: error: no matching function for call to 'Metro::Metro()'
Arduino/libraries/easedServo/../Metro/Metro.h:13: note: candidates are: Metro::Metro(long unsigned int, uint8_t)
Arduino/libraries/easedServo/../Metro/Metro.h:12: note:                 Metro::Metro(long unsigned int)
Arduino/libraries/easedServo/../Metro/Metro.h:9: note:                 Metro::Metro(const Metro&)

but don't get what he wants to tell me :-) guesses please.


have just set

    Metro metro_interval;


    static Metro metro_interval;

new error:

easedServo/easedServo.cpp.o: In function `easedServo::givePos(int)':
Arduino/libraries/easedServo/easedServo.cpp:39: undefined reference to `easedServo::metro_interval'
Arduino/libraries/easedServo/easedServo.cpp:39: undefined reference to `easedServo::metro_interval'

in the ccp in line 39 i just call

if(metro_interval.check() == 1)

getting closer? btw: i understand that the problem is that metro_interval is referenced to easedServo:: since it should be reverenced to Metro:: but dont know what i am doing wrong :-)

Well I don't find that error hard to understand - you have called 'Metro::Metro()' but the compiler has only found 'Metro::Metro(long unsigned int, uint8_t)', 'Metro::Metro(long unsigned int)' and 'Metro::Metro(const Metro&)'

So clearly the compiler has found the Metro library, but you are trying to use a function that doesn't exist in it.

no think thats not the point the only time i call the library is when initializing the metro object and the .check() function both are existing functions :-) more hints anyone?

got it working ... thanks anyway. if questions regarding this topic pm me.

Hi maerzhase,

I have the same problem you had, and I hope to solve it without having to change too much in my current program. So is there a different solution than the following one: header file: ... class ExternalClass; ..... class OwnClass{ .... ExternalClass* ptoExtClass; };

source file: ....

include "../Somewhere/ExternalClass.h"


Well this is what I know it will work, but I am writing my code in NotePad++, and I don´t have automatic code complition. So I would love it if I could skip the usage of -> - operators