I'm trying to get the dlib library working in my c++ project and don't know what to do with my Makefile and the #include<...> in the header file of my script. I have placed my header file and my script in the src directory. A symbolic link has been made to the dlib library, the link is in the include directory (see the folder structure below).
On the dlib website it says:
You should not add the dlib folder itself to your compiler's include path
Instead you should add the folder that contains the dlib folder to your include search path and then use include statements of the form #include . This will ensure that everything builds correctly.
The only thing I want is to include the dlib in my header file and make it compile so that I can use all the functions of dlib. Can you help me with this?
The folder structure is like this:
projectDir |-Makefile |-src | |-main.cpp | |-main.hpp |-include |-dlib (symbolic link) |-all | |-source.cpp |- lots of header files |-... The makefile looks like this:
CC := g++ # This is the main compiler # CC := clang --analyze # and comment out the linker last line for sanity SRCDIR := src LIBDIR := lib BUILDDIR:= build TARGET := bin/main SRCEXT := cpp SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)) OBJECTS := $(patsubst$(SRCDIR)/%,$(BUILDDIR) /%,$(SOURCES:.$(SRCEXT)=.o)) CFLAGS := -g # -Wall LIB := $(shell find $(LIBDIR) -type f -name *.$(SRCEXT)) INC := $(TARGET): $(OBJECTS) @echo " Linking..." $(CC) $^ -o $(TARGET) $(LIB) $(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) @mkdir -p $(BUILDDIR) $(CC) $(CFLAGS) $(INC) -c -o $@ $< clean: @echo " Cleaning..."; $(RM) -r $(BUILDDIR) $(TARGET) .PHONY: clean This is the main.cpp file:
#include "main.hpp" int main(){ return 0; } And the header file: main.hpp, is empty since I really don't know what to do with it.