user47068: I'm using the GxEPD2 library to communicate with an E-Paper display. I now wanted to use the drawPaged method of this library with an object display.
I also have written my own class from which I want to print stuff on the display.
Here's the relevant code for the MyClass.h:
class MyClass{
    //some variables and methods
    void drawClass(); //this is public
    void drawClassCallback(const void* v1); //this is private
    //    this is actually a uint8_t --^
}

And here's the MyClass.cpp:
void MyClass::drawClass(){
    //some display preparation
    uint8_t var; //A variable to pass information from the callback to this method since it is needed later
    display.drawPaged(std::bind(&MyClass::drawClassCallback, this, &var));
    //some code where I need var with info from the callback
}

I'm getting the following error:

no matching function for call to 'GxEPD2_BW::drawPaged(std::_Bind_helper::type)'
note: candidate: void GxEPD2_BW::drawPaged(void ()(const void), const void*) [with GxEPD2_Type = GxEPD2_290; short unsigned int page_height = 296u]
       void drawPaged(void (drawCallback)(const void), const void* pv)

I've also tried display.drawPaged(std::bind(&MyClass::drawClassCallback, this, std::placeholders::_1), &var) without success.
I've stumbled upon this post already, however the solution presented there (and the one used above) does not work in this case.
Why is that?

user69111: In your MyClass example, the drawPaged() call is given only a single argument, while according to the library, it needs two:
void drawPaged(void (*drawCallback)(const void*), const void* pv)

The first argument is the function pointer (or the one wrapped by std::bind!). The second argument seems to be some data that will be passed on to that function. (according to the [linked API)
The error actually explains it, it suspects that you are trying to call void GxEPD2_BW::drawPaged(void ()(const void), const void*). Hence it mentions this as a candidate.
What you need to do is something like this:
display.drawPaged(std::bind(&MyClass::drawClassCallback, this, std::placeholders::_1), &var);

std::placeholders::_1 is the placeholder that represents the var argument that will be passed on when it is called.

47068: <p>I'm using the <a href="https://github.com/ZinggJM/GxEPD2/tree/master/src" rel="nofollow noreferrer">GxEPD2 library</a> to communicate with an E-Paper display. I now wanted to use the <code>drawPaged</code> method of this library with an object <code>display</code>.</p>

<p>I also have written my own class from which I want to print stuff on the display.</p>

<p>Here's the relevant code for the MyClass.h:</p>

<pre><code>class MyClass{
    //some variables and methods
    void drawClass(); //this is public
    void drawClassCallback(const void* v1); //this is private
    //    this is actually a uint8_t --^
}
</code></pre>

<p>And here's the MyClass.cpp:</p>

<pre><code>void MyClass::drawClass(){
    //some display preparation
    uint8_t var; //A variable to pass information from the callback to this method since it is needed later
    display.drawPaged(std::bind(&amp;MyClass::drawClassCallback, this, &amp;var));
    //some code where I need var with info from the callback
}
</code></pre>

<p>I'm getting the following error:</p>

<blockquote>
  <p>no matching function for call to 'GxEPD2_BW::drawPaged(std::_Bind_helper::type)'</p>
  
  <p>note: candidate: void GxEPD2_BW::drawPaged(void (<em>)(const void</em>), const void*) [with GxEPD2_Type = GxEPD2_290; short unsigned int page_height = 296u]
       void drawPaged(void (<em>drawCallback)(const void</em>), const void* pv)</p>
</blockquote>

<p>I've also tried <code>display.drawPaged(std::bind(&amp;MyClass::drawClassCallback, this, std::placeholders::_1), &amp;var)</code> without success.</p>

<p>I've stumbled upon <a href="https://arduino.stackexchange.com/questions/56026/how-to-pass-non-static-class-member-to-callback">this post</a> already, however the solution presented there (and the one used above) does not work in this case.</p>

<p>Why is that?</p>
 69111: <p>In your <code>MyClass</code> example, the <code>drawPaged()</code> call is given only a single argument, while according to the library, it needs two:</p>
<pre class="lang-cpp prettyprint-override"><code>void drawPaged(void (*drawCallback)(const void*), const void* pv)
</code></pre>
<p>The first argument is the function pointer (or the one wrapped by <code>std::bind</code>!). The second argument seems to be some data that will be passed on to that function. (according to the [linked API)</p>
<p>The error actually explains it, it suspects that you are trying to call <code>void GxEPD2_BW::drawPaged(void ()(const void), const void*)</code>. Hence it mentions this as a candidate.</p>
<p>What you need to do is something like this:</p>
<pre class="lang-cpp prettyprint-override"><code>display.drawPaged(std::bind(&amp;MyClass::drawClassCallback, this, std::placeholders::_1), &amp;var);
</code></pre>
<p><code>std::placeholders::_1</code> is the placeholder that represents the <code>var</code> argument that will be passed on when it is called.</p>
