我下載了SDL2-2.0.3
。我跑了./configure && make && make install
。我也嘗試過brew install SDL2
。在OSX上安裝SDL
這是我的main.c
//Using SDL and standard IO
#include <SDL2/SDL.h>
#include <stdio.h>
//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
int main(int argc, char* args[]) {
SDL_Window* window = NULL;
SDL_Surface* screenSurface = NULL;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
}
}
當我運行它
~:.make main
gcc main.c -o main
Undefined symbols for architecture x86_64:
"_SDL_GetError", referenced from:
_main in main-d5699d.o
"_SDL_Init", referenced from:
_main in main-d5699d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1
~:.
如何安裝呢?
謝謝,編譯! – quantumpotato