Hello,
im having a little bit of difficulty, my program's directories is setup like this
Makefile
src/
---Game/
---Engine/
---SFML/
the problem is how im declaring the include in my file( i think). I am getting "SFML/Graphics.hpp no such file or directory" and i am declaring it as #include "../SFML/include/SFML/Graphics.hpp" but i have tried a few different ways like <SFML\Graphics.hpp> "SFML\Graphics.hpp"
is my makefile wrong or am i just declaring the include wrong in my .cpp?
makefile:
CC := g++
LD := g++
MODULES := Game Engine
SRC_DIR := $(addprefix src\,$(MODULES))
BUILD_DIR := $(addprefix build\,$(MODULES))
SFML_DIR := $(addprefix src/,SFML)
SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
OBJ := $(patsubst src/%.cpp,build/%.o,$(SRC))
INCLUDES := $(addprefix -I,$(SRC_DIR))
SFML_INC := $(addprefix -I,$(SFML_DIR)/include)
SFML_LIB_LOC:= $(addprefix -L,$(SFML_DIR)/lib)
SFML_LIB := -lsfml-graphics -lsfml-window -lsfml-system
vpath %.cpp $(SRC_DIR)
define make-goal
$1/%.o: %.cpp
$(CC) $(INCLUDES) -c $$< $(SFML_INC) -o $$@
endef
.PHONY: all checkdirs clean
all: checkdirs build/Thantos
build/Thantos: $(OBJ)
$(LD) $^ -o $@ $(SFML_LIB_LOC) $(SFML_LIB)
checkdirs: $(BUILD_DIR)
$(BUILD_DIR):
@mkdir $@
clean:
@rmdir $(BUILD_DIR) /s /q
$(foreach bdir,$(BUILD_DIR),$(eval $(call make-goal,$(bdir))))