Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JakeIzUndead

Pages: [1]
1
General / Re: Need help with include/Makefile
« on: April 03, 2017, 03:42:17 am »
I finally figured it out, if anyone is curious i misplaced my SFML_INC (inlude folder) instead of going under make-goal it was suppose to be under build job so:

Quote
build/Thantos: $(OBJ)
   $(LD) $(SFML_INC) $^ -o $@ $(SFML_LIB_LOC) $(SFML_LIB)

2
General / Need help with include/Makefile
« on: April 03, 2017, 02:16:23 am »
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:

Quote
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))))

Pages: [1]