Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22133

Installing SDL on OSX

$
0
0

I downloaded SDL2-2.0.3. I ran ./configure && make && make install.

I've also tried brew install SDL2.

This is my 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() );
 }
}

When I run it

~:.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
~:.

How do I install this?


Viewing all articles
Browse latest Browse all 22133

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>