title: SDL2.dll is missing from your computer
body: <p>Hi I am following an SDL tutorial, but when I try to run the program I get this error :</p>
  
  <pre><code>The program can't start because SDL2.dll is missing from your computer. Try reinstalling the program to fix this problem
  </code></pre>
  
  <p>None of the other answers to this question have helped me. I have tried placing the SDL2.dll file in the Debug folder with the .exe file, in the project root folder, and in the folder with the .cpp files</p>
  
  <p>I don't think my code matters for this issue, but here it is anyway.</p>
  
  <p>main.cpp</p>
  
  <pre><code> #include "MainGame.h"
  #include &lt;iostream&gt;
  int main(int argc, char ** argv)
  {
      MainGame mainGame;
      mainGame.run();
  
      return 0;
  }
  </code></pre>
  
  <p>MainGame.h</p>
  
  <pre><code>#pragma once
  #include &lt;SDL.h&gt;
  #include &lt;GL/glew.h&gt;
  
  enum class GameState {PLAY, EXIT};
  
  class MainGame
  {
  public:
      MainGame();
      ~MainGame();
  
      void run();
  private:
      void initSystems();
      void gameLoop();
      void processInput();
      void drawGame();
  
      SDL_Window * _window;
      int _screenWidth;
      int _screenHeight;
      GameState _gameState;
  };
  </code></pre>
  
  <p>MainGame.cpp</p>
  
  <pre><code>#include "MainGame.h"
  #include &lt;SDL.h&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  void fatalError(std::string errorString)
  {
      std::cout &lt;&lt; errorString &lt;&lt; std::endl;
      std::cout &lt;&lt; "Enter any key to quit....";
      int tmp;
      std::cin &gt;&gt; tmp;
      SDL_Quit();
  }
  MainGame::MainGame()
  {
      _window = nullptr;
      _screenWidth = 1024;
      _screenHeight = 720;
      _gameState = GameState::PLAY;
  }
  
  
  MainGame::~MainGame()
  {
  }
  
  void MainGame::run()
  {
      initSystems();
  
      gameLoop();
  }
  
  void MainGame::initSystems()
  {
      SDL_Init(SDL_INIT_EVERYTHING);
      _window = SDL_CreateWindow("Game Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, _screenWidth, _screenHeight, SDL_WINDOW_OPENGL);
  
      if (_window == nullptr)
      {
          fatalError("SDL Window could not be created!");
      }
  
      SDL_GLContext glContext = SDL_GL_CreateContext(_window);
      if (glContext == nullptr)
      {
          fatalError("SDL_GLContext could not be created!");
      }
  
      GLenum error = glewInit();
      if (error != GLEW_OK)
      {
          fatalError("Could not initialize glew");
      }
  
      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
  
      glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
  }
  
  void MainGame::gameLoop()
  {
      while(_gameState != GameState::EXIT)
      {
          processInput();
          drawGame();
      }
  }
  
  void MainGame::processInput()
  {
      SDL_Event e;
  
      while (SDL_PollEvent(&amp;e)) 
      {
          switch (e.type)
          {
              case SDL_QUIT:
                  _gameState = GameState::EXIT;
                  break;
              case SDL_MOUSEMOTION:
                  std::cout &lt;&lt; e.motion.x &lt;&lt; " " &lt;&lt; e.motion.y &lt;&lt; std::endl;
                      break;
          }
      }
  }
  
  void MainGame::drawGame()
  {
      glClearDepth(1.0);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
      SDL_GL_SwapWindow(_window);
  }
  </code></pre>
  
  <p>I'm using visual studio 2015.</p>