c++ - Include statement not working -


i creating own library arduino , have following code:

#include <arduino.h> #include <servo.h>  class servomotorcontroller {     public:         servomotorcontroller(int servopin, int motorpin, int angle);         void setangle(int angle);         void setspeed(int speed);     private:         servo servo;          int servopin;         int servoangle;         int motorpin;         int motorspeed; }; 

i getting error servo not name type; if

#include <servo.h> #include <servomotorcontroller.h> 

in actual arduino code not error. why include statement not working in c++ lib?

here more info:

file hierarchy:

arduino      libraries           myservo                servomotorcontroller .h                servomotorcontroller .cpp           servo                softwareservo.h                softwareservo.cpp      servo_program           servo_program.ino 

servomotorcontroller.h file shown above.

when use arduino ide include servo library does

#include <servo.h> #include <servomotorcontroller.h> 

and there no problems, if not include in arduino file , in .h&.cpp files says servo not name type.

too long comment box…

do use guards include files?

#ifndef servo_h #define servo_h  . . . . .  #endif    #ifndef servomotorcontroller_h #define servomotorcontroller_h  . . . . .  #endif 

Comments

Popular posts from this blog

android - Automated my builds -

how to proxy from https to http with lighttpd -

python - Flask migration error -