I am trying to configure SDL2 for use with g ++, a text editor, and a terminal. I have SDL2.framework in / Library / Frameworks. I have a folder on my desktop called testsdl that contains two files:
1) main.cpp
2) makefile
When I type make, I get the following error: main.cpp: 2: 10: fatal error: file "SDL2 / SDL.h" not found. here is a copy of my makefile
CXX = g++
SDL = -framework SDL2
CXXFLAGS = -Wall -c -std=c++11 -I ~/Library/Frameworks/SDL2.framework/Headers
LDFLAGS = $(SDL) -F /Library/Frameworks -F ~/Library/Frameworks/
EXE = SDL_Lesson0
all: $(EXE)
$(EXE): main.o
$(CXX) $(LDFLAGS) $< -o $@
main.o: main.cpp
$(CXX) $(CXXFLAGS) $< -o $@
clean:
rm *.o && rm $(EXE)
and here is a copy of main.cpp:
#include <iostream>
#include <SDL2/SDL.h>
int main(int, char**)
{
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Quit();
return 0;
}
I tried changing #include to "SDL2 / SDL.h" or just or any other possible combination. I had no problems configuring it through Xcode, but I cannot figure out how to do this without using the IDE.
:
, , SDL , ?
.