"dyld: Library not loaded... Incompatible library version" when compiling with -frameowork

43 views Asked by At

I'm have this source file

#include <SDL.h>
#include <stdio.h>

int main() {
    if (SDL_Init(SDL_INIT_VIDEO)) {
        printf("Hello SDL\n");
    }
    return 0;
}

I have the latest SDL2 installed in /Library/Frameworks.

I successfully compile using:

clang main.c -o game.out -I/Library/Frameworks/SDL2.framework/Headers -F/Library/Frameworks -framework SDL2 

When I try to run game.o (./game.out) I get this error

dyld: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
  Referenced from: /Users/Timothy/game/./game.out
  Reason: Incompatible library version: game requires version 2801.0.0 or later, but SDL2 provides version 1.0.0
Abort trap: 6

I don't understand why I'm able to compile but then when I run I get an incompatible version error.

0

There are 0 answers