In my project files I just want to be able to say:
main.cpp:
#include <foo.h> #include <bar.h>
When these headers files reside in separate
-Project -include -foo foo.h -bar bar.h -src main.cpp
I’ve setup my make file to attempt to achieve this but I still get fatal error: foo.h: No such file or directory
so I haven’t been able to set it up correctly.
Makefile:
LIBS = ./include/foo ./include/bar all: g++ -o bin/myapp src/main.cpp $(LIBS) -std=c++11
Is LIBS correct? How can I achieve relative/agnostic include paths?
Advertisement
Answer
INCLUDES = -I./include/foo -I./include/bar all: g++ -o bin/myapp src/main.cpp $(INCLUDES) -std=c++11