I need help with the contents of a make file. After some days of searching/experimenting, I now ask see picture):
- The "src" folder contains "application.cpp" and the make file. As a result, the executable file “application” should also be there.
- In "application.cpp" the 3 "#include "lib_n.h" (n = a,b,c) are present.
- The source files "lib_n.h / lib_n.cpp" are present in the "libs" folder.The files in the "libs" folder are probably not being translated. The linker marks all accesses to the libraries as undefined.
I need this division because I need the libraries in the "libs" folder for several similar projects (application_b, ...).
My non-working make file:
- The "src" folder contains "application.cpp" and the make file. As a result, the executable file “application” should also be there.
- In "application.cpp" the 3 "#include "lib_n.h" (n = a,b,c) are present.
- The source files "lib_n.h / lib_n.cpp" are present in the "libs" folder.
Code:
│ │ │ ┌───────────────────────────┐ ├──┤ folder "src" with ... │ │ │ application_a.cpp │ │ │ makefile │ │ │ application (executable) │ │ └───────────────────────────┘ │ ┌───────────────────────┐ └──┤ folder "libs" with ...│ │ lib_a.h │ │ lib_a.cpp │ │ lib_b.h │ │ lib_b.cpp │ │ lib_c.h │ │ lib_c.cpp │ └───────────────────────┘
I need this division because I need the libraries in the "libs" folder for several similar projects (application_b, ...).
My non-working make file:
Code:
IDIR =../inclCC = g++ -Wall -wCFLAGS = -lbcm2835 -lrt -lpthread -I$(IDIR)ODIR=objDEPS = $(patsubst %,$(IDIR)/%,)_OBJ = application.o OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))$(ODIR)/%.o: %.cpp $(DEPS)$(CC) -c -o $@ $< $(CFLAGS)application: $(OBJ)$(CC) -o $@ $^ $(CFLAGS) $(LIBS).PHONY: cleanclean:rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~
Statistics: Posted by RudolfAtHome — Sun Mar 31, 2024 6:29 pm