I was trying to write a very simple function to read ADC 20 times, remove min and max and find the average. I stored the readings in a std::vector arr, but this error keeps showing up
../wiring/inc/spark_wiring_arduino_constants.h:111:18: expected unqualified-id before '(' token
I realized even only include the "vector" library and not do anything else would still give the same error.
Here's my code. I commented out the function that has vectors in it. But even this is giving me error.
You don’t have to have used it. The standard library contains a definition of max (and min) that would conflict with one in the constants header. Just including the vector header could cause a clash.
I’m not sure if this is definitely the problem, but based on ScruffR’s bug report you should look into it carefully. Try:
#undef max
#include <vector>
Note that there may be other conflicts to deal with such as min.