user68298: I'm a little dumbfounded as to why this isn't working. I keep getting the following linker error:
In file included from src\ac.cpp:1:0:
src/ac.h:9:21: error: expected identifier before numeric constant
 #define RECEIVE_PIN 0
                     ^
src/ac.h:14:26: note: in expansion of macro 'RECEIVE_PIN'
     static IRrecv irrecv(RECEIVE_PIN);
                          ^
src/ac.h:9:21: error: expected ',' or '...' before numeric constant
 #define RECEIVE_PIN 0
                     ^
src/ac.h:14:26: note: in expansion of macro 'RECEIVE_PIN'
     static IRrecv irrecv(RECEIVE_PIN);
                          ^
*** [.pio\build\esp32cam\src\ac.cpp.o] Error 1
*** [.pio\build\esp32cam\src\main.cpp.o] Error 1

I am simply trying to initialize the IR receiver with static IRrecv irrecv(RECEIVE_PIN);, but the compiler is refusing to link it together.
#ifndef _AC_H_
#define _AC_H_

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>

#define RECEIVE_PIN 0

class IR
{
public:
    static IRrecv irrecv(RECEIVE_PIN);
    static decode_results results;
    void initRecv();
    bool waitForIR();
};

extern IR ir;

#endif

If I do static IRrecv irrecv; it successfully compiles, but I'm unsure if I can pass the pin variable after the fact.

user7508: Static data members have to be defined outside the class declaration.
The initialization happens at the point where the members are defined:
file ac.h:
//...

class IR
{
public:
    // Static data members are declared only:
    static IRrecv irrecv;
    static decode_results results;
    void initRecv();
    bool waitForIR();
};

file ac.cpp:
#include "ac.h"

#define RECEIVE_PIN 0

// Definitions and initializations of static data members:
IRrecv IR::irrecv(RECEIVE_PIN);
decode_results IR::results;


68298: <p>I'm a little dumbfounded as to why this isn't working. I keep getting the following linker error:</p>
<pre class="lang-cpp prettyprint-override"><code>In file included from src\ac.cpp:1:0:
src/ac.h:9:21: error: expected identifier before numeric constant
 #define RECEIVE_PIN 0
                     ^
src/ac.h:14:26: note: in expansion of macro 'RECEIVE_PIN'
     static IRrecv irrecv(RECEIVE_PIN);
                          ^
src/ac.h:9:21: error: expected ',' or '...' before numeric constant
 #define RECEIVE_PIN 0
                     ^
src/ac.h:14:26: note: in expansion of macro 'RECEIVE_PIN'
     static IRrecv irrecv(RECEIVE_PIN);
                          ^
*** [.pio\build\esp32cam\src\ac.cpp.o] Error 1
*** [.pio\build\esp32cam\src\main.cpp.o] Error 1
</code></pre>
<p>I am simply trying to initialize the IR receiver with <code>static IRrecv irrecv(RECEIVE_PIN);</code>, but the compiler is refusing to link it together.</p>
<pre class="lang-cpp prettyprint-override"><code>#ifndef _AC_H_
#define _AC_H_

#include &lt;Arduino.h&gt;
#include &lt;IRremoteESP8266.h&gt;
#include &lt;IRrecv.h&gt;
#include &lt;IRutils.h&gt;

#define RECEIVE_PIN 0

class IR
{
public:
    static IRrecv irrecv(RECEIVE_PIN);
    static decode_results results;
    void initRecv();
    bool waitForIR();
};

extern IR ir;

#endif
</code></pre>
<p>If I do <code>static IRrecv irrecv;</code> it successfully compiles, but I'm unsure if I can pass the pin variable after the fact.</p>
 7508: <p>Static data members have to be defined <em>outside</em> the class declaration.
The initialization happens at the point where the members are defined:</p>
<p><strong>file ac.h:</strong></p>
<pre class="lang-cpp prettyprint-override"><code>//...

class IR
{
public:
    // Static data members are declared only:
    static IRrecv irrecv;
    static decode_results results;
    void initRecv();
    bool waitForIR();
};
</code></pre>
<p><strong>file ac.cpp:</strong></p>
<pre class="lang-cpp prettyprint-override"><code>#include &quot;ac.h&quot;

#define RECEIVE_PIN 0

// Definitions and initializations of static data members:
IRrecv IR::irrecv(RECEIVE_PIN);
decode_results IR::results;
</code></pre>
