In file included from newping_distance_sensor.cpp:7:
newping_distance_sensor.h:26: error: ‘NewPing’ does not name a type
just when I try to declare a variable:
class DistanceSensor : public DistanceSensorDriver
{
private:
NewPing m_sensor;
};
Countless people had this error because they didn't install the NewPing library but I have ! I can see it in Sketch > Import Library. AND I have the line
#include <NewPing.h>
at the top of my file (but the ".h" doesn't have the same color than "NewPing", is that normal?). I'm on Ubuntu 12.04
The usual one for people that post in the Programming section without posting all of there code. But, I'll be nice and keep that to myself. Hopefully, though, you have an idea what you need to do.
but it doesn't work if I comment out "#include <NewPing.h>" in main.ini, and I don't understand why since #include <NewPing.h> is still at the top of Robot.h !
it doesn't work if I comment out "#include <NewPing.h>" in main.ini, and I don't understand why since #include <NewPing.h> is still at the top of Robot.h !
I think you will find that this is a quirk of how the Arduino IDE assembles the actual file to be compiled from the bits an pieces needed, and that it a requirement to #include all library files used by the program in the master program file whether or not they are #included in library files.
By the way, do you really have a file called main.ini containing code or was that a typo ?