Reputation: 497
I am working on a Raspberry Pi 2.
I need to use the arduPi library like in this example. I followed the installation procedure and I copied the code example. I tried to compile it with gcc but I got the following error:
arduPi.h:44:21: fatal error: algorithm: No such file or directory
#include <algorithm>
Do you know how can I fix it?
Upvotes: 0
Views: 10418
Reputation: 7220
The site very clearly says that the example is a "C++" code:
arduPi is a C++ library that lets you write programs for Raspberry Pi as if you were writing an arduino program. All the functions in order to control Serial port communications, i2C, SPI and GPIO pins are available using the arduino syntax.
In the example where they build the code they even reference g++ (not gcc):
g++ -lrt -lpthread MY_PROGRAM.cpp arduPi.o -o MY_PROGRAM
Have you written your own program in C++? if not then you need to handle the C++ header from the example, and wrap i properly, otherwise change your code to C++ (provided you can, most often it is no problem).
Upvotes: 3