4
I am trying to compile a project in c++ using the following Makefile code:
OBJS = main.o src.o
SDIR = ./src
IDIR = ./include
BDIR = ./bin/
ODIR = $(BDIR)/obj
all: main
%.o: $(SDIR)/%.cpp $(IDIR)/%.h
g++ -c -o $(ODIR)/$@ $(SDIR)/$< -I $(IDIR)
main: $(OBJS)
g++ -o $@ $^ -I $(IDIR)
When I try to compile the program the following error appears in the terminal:
xxxx@zzz:$ make
g++ -c -o main.o main.cpp
main.cpp:2:17: fatal error: src.h: Arquivo ou diretório não encontrado
#include "src.h"
^
compilation terminated.
<builtin>: recipe for target 'main.o' failed
make: *** [main.o] Error 1
But the file 'src. h' exists and is within simply include. So I would like to know what the reason for the error is.