This is because you do not have a rule for something.o , you have a rule for ../bin/something.o .
If you change the OBJ declaration to
OBJ = ../$(BIN_DIR)/FixedLengthFieldsRecord.o ../$(BIN_DIR)/FixedLengthRecordFile.o ../$(BIN_DIR)/main.o
It should work.
You can get objects from the source directory using wildcards
SOURCES := $(wildcard $(SRC_DIR)/*.cpp) OBJ := $(patsubst $(SRC_DIR)/%,%,$(SOURCES)) OBJ := $(patsubst %.cpp,%.o,$(OBJ)) OBJ := $(addprefix ../$(BIN_DIR)/,$(OBJ))
What this means is that first it gets a list of cpp files from $(SRC_DIR) , removes the path, then replaces all cpp suffixes for o and finally adds `../$ $(SRC_DIR) /` before each element.
source share