title: SDL_LoadBMP() displaying a black surface while surface is referenced
body: <p>Trying to load an image onto an SDL_Surface. However the surface is always black although the bmp is clearly not. </p>
  
  <p>NOTE</p>
  
  <p>This is a working SDL_Window and creating a surface pointer is successful, what is unsuccessful is loading "Kassadin.bmp" which is located in the Code::Blocks project folder. It displays a black surface. </p>
  
  <p>ALL answers on this particular question have NOT solved this problem, before marking this as a duplicate. </p>
  
  <pre><code>  #include &lt;iostream&gt;
    #include &lt;SDL.h&gt;
    #include &lt;stdio.h&gt;
  
    using namespace std;
  
    const int SCREEN_WIDTH = 700;
    const int SCREEN_HEIGHT = SCREEN_WIDTH / 12 * 9;
  
    //Create an SDL_Window pointer
    SDL_Window* window = NULL;
  
    //Create an SDL_Surface pointer
    SDL_Surface* surface = NULL;
  
    //SDL_Surface for an image
    SDL_Surface* imgSurface = NULL;
  
    bool init(){
    //try init SDL
    if(SDL_Init(SDL_INIT_VIDEO) &lt; 0){
      cout &lt;&lt; "Failed init SDL" &lt;&lt; endl;
      return false;
    }else{
  
      //create window           title            x pos                    y  pos                    width         height         flags
      //This doesnt include a surface ie it will be a plain window
      window = SDL_CreateWindow("An SDL Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
  
  }
  
  if(window == NULL){
      cout &lt;&lt; "Failed creating SDL window" &lt;&lt; endl;
      return false;
  }else{
      // creates surface with an SDL_Window object
      surface = SDL_GetWindowSurface(window);
  }
  return true;
  }
  
  bool loadMedia(){
  imgSurface = SDL_LoadBMP("Kassadin.bmp");
  
  return true;
  }
  
  void close(){
  //Sets the SDL_Window pointer to NULL again
  SDL_DestroyWindow(window);
  
  window = NULL;
  
  SDL_FreeSurface (imgSurface);
  imgSurface = NULL;
  
  //quits
  SDL_Quit();
  }
  
  int main(int argc, char* argv[]){
  
  if(!init()){
      cout &lt;&lt; "error init sdl" &lt;&lt; endl;
  }else{
  
      if(!loadMedia){
          cout &lt;&lt; "Trouble loading media..." &lt;&lt; endl;
      }else{
  
          SDL_BlitSurface(imgSurface, NULL, surface, NULL);
  
      }
  
  }
  
  //This is so it's not just a static window ie it can update
  SDL_UpdateWindowSurface(window);
  
  SDL_Delay(5000);
  
  close();
  
  return 0;
  }
  </code></pre>