Having problem with statistic library

Hi,

I’ve having problems with installing the statistic library (https://playground.arduino.cc/Main/Statistics)
I’m using Arduino 1.8.4 and an Uno.

In Sketch → include library → manage libraries I searched for “statistic” but could not find this library.

I went to https://github.com/RobTillaart/Arduino and did a code → “clone or download” and extracted the statistic folder into my libraries folder in the Arduino installation folder.

Tried both #include “Statistic.h” and #include <Statistic.h> but I keep getting allot of errors starting with:

In file included from E:\Programs\arduino-1.8.4\libraries\Statistic\Statistic.cpp:55:0:

E:\Programs\arduino-1.8.4\libraries\Statistic\Statistic.h:30:5: error: 'uint32_t' does not name a type

     uint32_t count() const { return _cnt; }; // zero if empty

     ^

What am I’m doing wrong?
Zohar

try to install the .zip library directly

go to sketch>include library>add .zip files.

goodluck!

What am I’m doing wrong?

You did not show your code.
You did not tell us which version of the IDE you are using.
You did not tell us which Arduino you are compiling for.

I downloaded the library, and got the same errors compiling the example sketch.

I edited the Statistic.h file, and added

#include <Arduino.h>

after the existing #include statement, and the example compiles for a Duemilanove using 1.8.2.

The #include <Arduino.h> did not help :frowning:

The error even show on a minimized example code:

#include "Statistic.h"  // without trailing s
#include <Arduino.h>

Statistic myStats; 
void setup(void) 
{
  myStats.clear(); //explicitly start clean
}
void loop(void) 
{
  myStats.add(100.0);
}

And I still get the same errors:

In file included from E:\Users\Zohar\Docs\Computer\Arduino\test1\test1.ino:1:0:

E:\Programs\arduino-1.8.4\libraries\Statistic/Statistic.h:30:5: error: 'uint32_t' does not name a type

     uint32_t count() const { return _cnt; }; // zero if empty

     ^

E:\Programs\arduino-1.8.4\libraries\Statistic/Statistic.h:43:5: error: 'uint32_t' does not name a type

     uint32_t _cnt;

     ^

exit status 1
Error compiling for board Arduino/Genuino Uno.

Using Arduino 1.8.4 with Uno board and windows 8 64bit

Could you explain how you installed the library (not sure that I do correct way)

Zohar

The #include <Arduino.h> did not help

Because you added it to the sketch, not to the library header file.

Could you explain how you installed the library (not sure that I do correct way)

The path that the compiler output shows that you did install it properly. Now, edit E:\Programs\arduino-1.8.4\libraries\Statistic/Statistic.h, and add the #include statement there.

PaulS Thanks!

Adding the #include <Arduino.h> to Statistic.h solved the problem.

Zohar

Apologies for not reacting sooner but I'm seldom at the forum these days (other priorities).

This bug slipped through and I will update the lib in GITHUB repo asap.

Sorry for the inconvenience, Rob

Fixed and updated lib on GITHUB - https://github.com/RobTillaart/Arduino/tree/master/libraries