0

I'm programming on Xcode. I include SDL_image.h as #include <SDL2/SDL_image.h>

and it says 'SDL2/SDL_image.h' file not found

I have installed and linked binary with libraries both SDL2.framework and SDL2_image.framework.

I used a Makefile to compile and there is an error: fatal error: 'SDL2/SDL_image.h' file not found

Here is my Makefile

# set the compiler
CC := clang

# set the compiler flags
CXXFLAGS = -std=c++14 -Wall -MMD -Werror=vla pkg-config --cflags --libs sdl2 `-L/Library/Frameworks/ sdl2-config --libs --cflags` -ggdb3 -O0 --std=c99 -Wall -l SDL2_image -lm

# add source files here
SRCS := main.cpp #file-name.c

# generate names of object files
OBJS := $(SRCS:.c=.o)

# name of executable
EXEC := sdl #name your executable file

# default recipe
all: $(EXEC)

showfont: showfont.c Makefile
    $(CC) -o $@ $@.c $(CFLAGS) $(LIBS)

glfont: glfont.c Makefile
    $(CC) -o $@ $@.c $(CFLAGS) $(LIBS)

# recipe for building the final executable
$(EXEC): $(OBJS) $(HDRS) Makefile
    $(CC) -o $@ $(OBJS) $(CFLAGS)

# recipe for building object files
#$(OBJS): $(@:.o=.c) $(HDRS) Makefile
#    $(CC) -o $@ $(@:.o=.c) -c $(CFLAGS)

# recipe to clean the workspace
clean:
    rm -f $(EXEC) $(OBJS)

.PHONY: all clean
user4581301
  • 33,082
  • 7
  • 33
  • 54
lucy yu
  • 1
  • 1

0 Answers0