Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL2 headers not being found when compiling os x

Tags:

c++

macos

sdl-2

I can't seem to compile this program. I have other people in my class that are having no problem compiling this code. I'm using the same command to try to compile the program and installed the frameworks in the same directory as them. /Library/Frameworks. I also installed eclipse and followed the zamma.co.uk tutorial to setup sdl2 and that didn't work either. Here is the command i'm running when compiling

g++ -std=c++11 -o Gravity main.cpp Game.cpp Particle.cpp Point.cpp -I/Library/Frameworks/SDL2.framework/Headers -framework SDL2 -framework Cocoa

Note: I have tried both

#include <SDL.h>

and

#include <SDL2/SDL.h> 

and neither work

like image 821
o.hdz1 Avatar asked Dec 06 '15 00:12

o.hdz1


1 Answers

The ld linker error you mention in your comments suggests you may need to pass the -F option or -L in case your features/library search path is not finding your SDL2 installation.

Your problem sounds similar to:

  • linker command failed, sdl
  • How do you include files in C++ from the /Library/Framework folder in MAC
like image 98
Drew MacInnis Avatar answered Nov 12 '22 21:11

Drew MacInnis