title: dyld: Library not loaded...reason image not found?
body: <p>I'm new to c++ and XCode, I'm using <code>sdl2</code> to create a window but when i compile it, it crashes giving me a thread.I have included <code>opengl.h</code> , <code>stdio.h</code> and <code>SDL2.h</code>. There are questions about </p>
  
  <blockquote>
    <p>dlyd:library not loaded but their different.</p>
  </blockquote>
  
  <p><strong>Error Message:</strong></p>
  
  <blockquote>
    <p>dyld: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2   Referenced from:
    /Users/shayanrazavi/Library/Developer/Xcode/DerivedData/c++_code-bbdyozxqxxdxosbxuyhcrqobxrkd/Build/Products/Debug/c++
    code</p>
    
    <p>Reason: image not found</p>
  </blockquote>
  
  <p>This is the code I used i couldn't get int main to be inside the code block for some reason but anyway and I got this code from <a href="https://wiki.libsdl.org/SDL_CreateWindow" rel="nofollow">https://wiki.libsdl.org/SDL_CreateWindow</a>.</p>
  
  <pre><code>int main(int argc, char* argv[]) {
    SDL_Window *window;                    // Declare a pointer
    SDL_Init(SDL_INIT_VIDEO);              // Initialize SDL2
  
    // Create an application window with the following settings:
    window = SDL_CreateWindow(
      "An SDL2 window",                  // window title
      SDL_WINDOWPOS_UNDEFINED,           // initial x position
      SDL_WINDOWPOS_UNDEFINED,           // initial y position
      640,                               // width, in pixels
      480,                               // height, in pixels
      SDL_WINDOW_OPENGL                  // flags - see below
    );
  
    // Check that the window was successfully made
    if (window == NULL) {
      // In the event that the window could not be made...
      printf("Could not create window: %s\n", SDL_GetError());
      return 1;
    }
  
    // The window is open: enter program loop (see SDL_PollEvent)
    SDL_Delay(3000);  // Pause execution for 3000 milliseconds, for example
  
    // Close and destroy the window
    SDL_DestroyWindow(window);
  
    // Clean up
    SDL_Quit();
    return 0;
  }
  </code></pre>