title: std::invoke no matching overloaded function found error given in VS 2015
body: <p>I'm very new to C++ and SDL and I am trying to create a thread that constantly updates the screen but the I keep getting the following errors:</p>
  
  <blockquote>
    <p>'std::invoke no matching overloaded function found'</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>'Failed to specialize function template 'unknown-type std::invoke(Callable &amp;&amp;,_Types&amp;&amp;...)''</p>
  </blockquote>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>  int main(int argc, char **argv) {
      using namespace std::placeholders;
      bool gameover = false;
      int test;
      std::string filepath = getResourcePath("Lesson1");
  
      if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {               // Intializes SDL functionality
          std::cout &lt;&lt; "Could not start SDL" &lt;&lt; std::endl;
          std::cin &gt;&gt; test;
          return 1;
      }
      else {
          std::cout &lt;&lt; "SDL started successfully!" &lt;&lt; std::endl;
      }
  
      viewWindow window;                                  // Class representing the window in which the program is run.
  
  
      SDL_Renderer *render = window.render();         // Pointer to the renderer used to draw images to the window.
      if (render == nullptr) {
          std::cout &lt;&lt; "There was an error creating the renderer" &lt;&lt; std::endl &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
          std::cin &gt;&gt; test;
          return 1;
      }
  
      SDL_Surface *emptySurface = window.blankSurface();   // Temp surface to draw background to
      if (emptySurface == nullptr) {
          std::cout &lt;&lt; "Unable to create a blank surface " &lt;&lt; std::endl &lt;&lt; SDL_GetError() &lt;&lt; std::endl;;
          std::cin &gt;&gt; test;
          return 1;
      }
  
      surfaces background;
  
      background.filename = "grass.bmp";
  
      SDL_Surface *backgroundSurface = background.loadSurface(filepath); 
      if (backgroundSurface == nullptr) {
          std::cout &lt;&lt; "Unable to create background surface" &lt;&lt; std::endl &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
          std::cin &gt;&gt; test;
          return 1;
      }
  
      SDL_Rect backgroundRect;
  
          SDL_Texture *backTexture = background.blitBack(render, backgroundRect, backgroundSurface, emptySurface);
  
  
  
          player player;
  
          SDL_Rect playerRect;
          playerRect.x = 320;
          playerRect.y = 240;
          playerRect.h = 16;
          playerRect.w = 16;
  
  
          SDL_Texture *playerTexture = player.createPlayerTexture(render, filepath);
          if (playerTexture == nullptr) {
              std::cout &lt;&lt; "Could not load player texture" &lt;&lt; std::endl &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
              std::cin &gt;&gt; test;
              return 1;
          }
  
          while (!gameover) {
              std::thread t((&amp;viewWindow::refreshWindow, render, playerRect, backTexture, playerTexture));
              playerRect.x = player.moveX(playerRect);
              playerRect.y = player.moveY(playerRect);
              t.join();
          }
  
  
      return 0;
     }
  </code></pre>
  
  <p><strong>viewWindow.h</strong></p>
  
  <pre><code>   #pragma once
  #ifndef VIEWINDOW_H
  #define VIEWWINDOW_H
  #include "SDL.h"
  
  
  
  class viewWindow                // Class representing the window.
  {
  private:
      char winName[45] = "Game Test";
      int winWidth = 640;
      int winHeight = 480;
      int xPos = 960;
      int yPos = 540;
  
  
  public:
  
  
       SDL_Window *view();    // Intializing funtions for creating the window and renderer.
  
       SDL_Renderer *render();
  
       SDL_Surface *blankSurface();
  
      void refreshWindow(SDL_Renderer *renderer, SDL_Rect &amp;playerRect, SDL_Texture *backtex, SDL_Texture *playertex);
  
  };
  
  
  #endif
  </code></pre>
  
  <p><strong>viewWindow.cpp</strong></p>
  
  <pre><code>   #include "viewWindow.h"
  #include &lt;string&gt;
  #include "SDL.h"
  
  
  SDL_Window *viewWindow::view()      
  {
      SDL_Window *createdwindow = SDL_CreateWindow(winName, xPos, yPos, winWidth, winHeight, SDL_WINDOW_SHOWN);
      return createdwindow;
  
  }
  
  SDL_Renderer *viewWindow::render() {
  
      SDL_Renderer *render = SDL_CreateRenderer(view(), -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
      return render;
  }
  
  SDL_Surface *viewWindow::blankSurface() {
      SDL_Surface *blacksurface = SDL_CreateRGBSurface(0, winWidth, winHeight, 32, 0, 0, 0, 0);
      return blacksurface;
  }
  
  void  viewWindow::refreshWindow(SDL_Renderer *renderer, SDL_Rect &amp;playerRect, SDL_Texture *backtex, SDL_Texture *playertex) {
      while (true) {
          SDL_RenderClear(renderer);
          SDL_RenderCopy(renderer, backtex, NULL, NULL);
          SDL_RenderCopy(renderer, playertex, NULL, &amp;playerRect);
          SDL_RenderPresent(renderer);
      }
  
  }
  </code></pre>