Skip to content

Instantly share code, notes, and snippets.

@JohannesMP
Created August 4, 2015 18:22
Show Gist options
  • Save JohannesMP/6ff3463482ebbdc82c2e to your computer and use it in GitHub Desktop.
Save JohannesMP/6ff3463482ebbdc82c2e to your computer and use it in GitHub Desktop.
# SDL2.framework is in the correct location:
$ ls /Library/Frameworks
AEProfiling.framework AudioMixEngine.framework PluginManager.framework iTunesLibrary.framework
AERegistration.framework NyxAudioAnalysis.framework SDL2.framework
# Frameworks direction is included in path (Note: shouldn't actually matter)
$ echo $PATH
/Users/Jo/_UTIL:/Library/Frameworks:/usr/local/lib:/usr/local/include:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
# Source file for a simple sdl2 program
$ ls
sdl2_test.c
# Attempting to compile object code FAILS without -F flag
$ gcc sdl2_test.c -c -o sdl2_test.o -framework SDL2
sdl2_test.c:1:22: fatal error: SDL2/SDL.h: No such file or directory
#include "SDL2/SDL.h"
^
compilation terminated.
# Attempting to compile object file SUCCEEDS with -F flag
$ gcc sdl2_test.c -c -o sdl2_test.o -framework SDL2 -F /Library/Frameworks
$ ls
sdl2_test.c sdl2_test.o
# Attempting to link object file FAILS without -F flag
$ gcc sdl2_test.o -o sdl2_test -framework SDL2
ld: framework not found SDL2
collect2: error: ld returned 1 exit status
# Attempting to link object file SUCCEEDS with -F flag
$ gcc sdl2_test.o -o sdl2_test -framework SDL2 -F /Library/Frameworks
$ ls
sdl2_test sdl2_test.c sdl2_test.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment