user46984: How can I declare an empty global array, to be initialized in setup?
What I would like to do is this:
#include <ResponsiveAnalogRead.h>

const size_t ANALOG_SIZE = 3;
const int ANALOG_PINS[ANALOG_SIZE] = {A0,A1,A2};
ResponsiveAnalogRead analog_reads[ANALOG_SIZE];


void setup() {
  for(size_t i=0; i<ANALOG_SIZE; i++){
    analog_reads[i]=ResponsiveAnalogRead(ANALOG_PINS[i], true, 0.01);
  }
}

But the error I get is:
sketch_may29c:5: error: no matching function for call to 'ResponsiveAnalogRead::ResponsiveAnalogRead()'
 ResponsiveAnalogRead analog_reads[ANALOG_SIZE];

                                              ^

Is it impossible to declare an empty array of a given size?

user337: When you declare an array it will call the default constructor for the type. ResponsiveAnalogRead does not have a default constructor so it cannot initialize the entries in the array.

user7508: Craig already explained the reason of the error is the lack of a default
constructor, and chrisl suggested a reasonable alternative. I would like
to suggest two other alternatives.
Static initialization
You state that you want to do the initialization in setup(), but you
don't explain why you want that. I will guess that what you really
want is to have all those objects in array. The library page provides
this example showing how to statically initialize multiple instances:
ResponsiveAnalogRead analogOne(A1, true);
ResponsiveAnalogRead analogTwo(A2, true);

The problem with this example is that you don't have an array, so you
cannot loop through the instances. This problem, however, can be easily
fixed:
const size_t ANALOG_SIZE = 3;
ResponsiveAnalogRead analog_reads[ANALOG_SIZE] = {
    ResponsiveAnalogRead(A0, true),
    ResponsiveAnalogRead(A1, true),
    ResponsiveAnalogRead(A2, true)
};

Note that you don't need the ANALOG_PINS array anymore. And you don't
need to pass 0.01 as the last argument to the constructor, as this is
the default value anyway. This would be my preferred solution: it is
simple enough and doesn't increase the number of lines of code.
Patching the library
If you really want to initialize the array in setup(), then you can
patch the file ResponsiveAnalogRead.h from the library:

Add default values to all the parameters of the constructor. For
example:

ResponsiveAnalogRead(int pin=0, bool sleepEnable=0, float snapMultiplier=0.01);


Add a method for setting the pin after initialization:

void setPin(int newPin) { pin = newPin; pinMode(pin, INPUT); }

The first change will enable you to compile your code as-is. The second
change will allow you to update the objects in setup() rather than
overwriting them (which I don't find very elegant):
for (size_t i = 0; i < ANALOG_SIZE; i++) {
    analog_reads[i].setPin(ANALOG_PINS[i]);
    analog_reads[i].enableSleep();
}

Note that using the default constructor now has the side effect of
setting pin 0 to input. This should not be a big deal, as the
constructor is called before setup(), and all the IO pins are inputs
at this point. If you want nevertheless to void that side effect, then
set the default pin to -1, and patch the constructor to only configure
the pin if it's not -1.
Patching the library creates a maintenance burden though: you will have
to reapply the patch each time the library is updated. This may not be
that bad if you know how to git rebase or git merge, but ideally you
would want to get a pull request accepted by the original maintainer.
Edit: Before patching the library, consider weighting in this
issue and using this fork.
Update: A pull request addressing this issue has been
accepted. As of version 1.2.0, the class has now a default “do nothing”
constructor.

user42015: As Craig wrote, the declaration of an class typed array will call the default constructor of the class, which is the one without any arguments. The class, that you use, does not provide a default constructor, since it needs it's parameters. You cannot do it this way.
But you can use dynamic allocation. In global scope only declare an array of pointers to ResponsiveAnalogRead objects:
ResponsiveAnalogRead *analog_reads[ANALOG_SIZE];

This array only holds pointers, that can point to ResponsiveAnalogRead objects. The objects themselves are not created yet. In setup() you can then create the objects dynamically with the new statement:
analog_reads[0] = new ResonsiveAnalogRead( input_parameters);

(Of course you have to replace input_parameters with all parameters, that the constructor needs). To call a member of the object, you can dereference it like this:
analog_reads[0]->member_function();

If you don't know about pointers yet, you should google for a tutorial (there are plenty), so that you understand the principle behind them.
Important note: Dynamic allocations of memory geht written to the heap in RAM. Since the Arduino (especially the Atmega based ones) has only very limited RAM, dynamic allocations have to be handled with great care. You should not create and delete data often in your program, since this would make swiss cheese out of your heap. But allocating the memory only once in your program and never deleting it, will not be a problem, as long as you don't try to allocate too much memory.

46984: <p>How can I declare an empty global array, to be initialized in setup?</p>

<p>What I would like to do is this:</p>

<pre><code>#include &lt;ResponsiveAnalogRead.h&gt;

const size_t ANALOG_SIZE = 3;
const int ANALOG_PINS[ANALOG_SIZE] = {A0,A1,A2};
ResponsiveAnalogRead analog_reads[ANALOG_SIZE];


void setup() {
  for(size_t i=0; i&lt;ANALOG_SIZE; i++){
    analog_reads[i]=ResponsiveAnalogRead(ANALOG_PINS[i], true, 0.01);
  }
}
</code></pre>

<p>But the error I get is:</p>

<pre><code>sketch_may29c:5: error: no matching function for call to 'ResponsiveAnalogRead::ResponsiveAnalogRead()'
 ResponsiveAnalogRead analog_reads[ANALOG_SIZE];

                                              ^
</code></pre>

<p>Is it impossible to declare an empty array of a given size?</p>
 337: <p>When you declare an array it will call the <a href="http://en.cppreference.com/w/cpp/language/default_constructor" rel="nofollow noreferrer">default constructor</a> for the type. ResponsiveAnalogRead does not have a default constructor so it cannot initialize the entries in the array.</p>
 7508: <p>Craig already explained the reason of the error is the lack of a default
constructor, and chrisl suggested a reasonable alternative. I would like
to suggest two other alternatives.</p>

<h2>Static initialization</h2>

<p>You state that you want to do the initialization in <code>setup()</code>, but you
don't explain <em>why</em> you want that. I will guess that what you <em>really</em>
want is to have all those objects in array. The library page provides
this example showing how to statically initialize multiple instances:</p>



<pre class="lang-c++ prettyprint-override"><code>ResponsiveAnalogRead analogOne(A1, true);
ResponsiveAnalogRead analogTwo(A2, true);
</code></pre>

<p>The problem with this example is that you don't have an array, so you
cannot loop through the instances. This problem, however, can be easily
fixed:</p>

<pre class="lang-c++ prettyprint-override"><code>const size_t ANALOG_SIZE = 3;
ResponsiveAnalogRead analog_reads[ANALOG_SIZE] = {
    ResponsiveAnalogRead(A0, true),
    ResponsiveAnalogRead(A1, true),
    ResponsiveAnalogRead(A2, true)
};
</code></pre>

<p>Note that you don't need the <code>ANALOG_PINS</code> array anymore. And you don't
need to pass <code>0.01</code> as the last argument to the constructor, as this is
the default value anyway. This would be my preferred solution: it is
simple enough and doesn't increase the number of lines of code.</p>

<h2>Patching the library</h2>

<p>If you <em>really</em> want to initialize the array in <code>setup()</code>, then you can
patch the file ResponsiveAnalogRead.h from the library:</p>

<ol>
<li>Add default values to all the parameters of the constructor. For
example:</li>
</ol>

<pre class="lang-c++ prettyprint-override"><code>ResponsiveAnalogRead(int pin=0, bool sleepEnable=0, float snapMultiplier=0.01);
</code></pre>

<ol start="2">
<li>Add a method for setting the pin after initialization:</li>
</ol>

<pre class="lang-c++ prettyprint-override"><code>void setPin(int newPin) { pin = newPin; pinMode(pin, INPUT); }
</code></pre>

<p>The first change will enable you to compile your code as-is. The second
change will allow you to update the objects in <code>setup()</code> rather than
overwriting them (which I don't find very elegant):</p>

<pre class="lang-c++ prettyprint-override"><code>for (size_t i = 0; i &lt; ANALOG_SIZE; i++) {
    analog_reads[i].setPin(ANALOG_PINS[i]);
    analog_reads[i].enableSleep();
}
</code></pre>

<p>Note that using the default constructor now has the side effect of
setting pin 0 to input. This should not be a big deal, as the
constructor is called before <code>setup()</code>, and all the IO pins are inputs
at this point. If you want nevertheless to void that side effect, then
set the default pin to <code>-1</code>, and patch the constructor to only configure
the pin if it's not <code>-1</code>.</p>

<p>Patching the library creates a maintenance burden though: you will have
to reapply the patch each time the library is updated. This may not be
that bad if you know how to <code>git rebase</code> or <code>git merge</code>, but ideally you
would want to get a pull request accepted by the original maintainer.</p>

<p><strong>Edit</strong>: Before patching the library, consider weighting in <a href="https://github.com/dxinteractive/ResponsiveAnalogRead/issues/11" rel="nofollow noreferrer">this
issue</a> and using <a href="https://github.com/kschaffer/ResponsiveAnalogRead" rel="nofollow noreferrer">this fork</a>.</p>

<p><strong>Update</strong>: A <a href="https://github.com/dxinteractive/ResponsiveAnalogRead/pull/15" rel="nofollow noreferrer">pull request</a> addressing this issue has been
accepted. As of version 1.2.0, the class has now a default “do nothing”
constructor.</p>
 42015: <p>As Craig wrote, the declaration of an class typed array will call the default constructor of the class, which is the one without any arguments. The class, that you use, does not provide a default constructor, since it needs it's parameters. You cannot do it this way.</p>

<p>But you can use dynamic allocation. In global scope only declare an array of pointers to <code>ResponsiveAnalogRead</code> objects:</p>

<pre><code>ResponsiveAnalogRead *analog_reads[ANALOG_SIZE];
</code></pre>

<p>This array only holds pointers, that can point to <code>ResponsiveAnalogRead</code> objects. The objects themselves are not created yet. In <code>setup()</code> you can then create the objects dynamically with the <code>new</code> statement:</p>

<pre><code>analog_reads[0] = new ResonsiveAnalogRead( input_parameters);
</code></pre>

<p>(Of course you have to replace <code>input_parameters</code> with all parameters, that the constructor needs). To call a member of the object, you can dereference it like this:</p>

<pre><code>analog_reads[0]-&gt;member_function();
</code></pre>

<p>If you don't know about pointers yet, you should google for a tutorial (there are plenty), so that you understand the principle behind them.</p>

<p>Important note: Dynamic allocations of memory geht written to the heap in RAM. Since the Arduino (especially the Atmega based ones) has only very limited RAM, dynamic allocations have to be handled with great care. You should not create and delete data often in your program, since this would make swiss cheese out of your heap. But allocating the memory only once in your program and never deleting it, will not be a problem, as long as you don't try to allocate too much memory.</p>
