Ich habe einige opencv C++ Code auf ubuntu, deren Ordnerstruktur ist:kann nicht kompilieren Make-Datei mit
|-- bin
| |-- camera-calib.o
| `-- frontalize.o
|-- docs
| `-- notes.md
|-- LICENSE.md
|-- Makefile
|-- README.md
|-- shape_predictor_68_face_landmarks.dat
`-- src
|-- calib
| |-- calib.cpp
| |-- calib.h
| |-- POSIT.cpp
| |-- POSIT.h
| |-- pro
| | |-- calib.o
| | |-- Makefile
| | |-- POSIT.o
| | |-- pro
| | |-- pro.pro
| | |-- pro.pro~
| | `-- util.o
| `-- util
| |-- calib_util.cpp
| `-- calib_util.h
|-- camera-calib.cpp
|-- camera-calib.h
|-- check_resources.h
|-- fatialfeaturedetect.cpp
|-- frontalization-models
| |-- DataAlign2LFWa.mat
| |-- eyemask.mat
| `-- model3Ddlib.mat
|-- frontalize.cpp
|-- frontalize.h
`-- main.cpp
Das Makefile ich verwende ist:
EXE = face_frontalization
OBJ_DIR = bin
CFLAGS = -g -w
dummy_build_folder := $(shell mkdir -p $(OBJ_DIR))
# c++ source files of the project
CXXFILES = $(shell find src -maxdepth 3 -type f -name '*.cpp')
CXXOBJ = $(patsubst src/%.cpp,bin/%.o,$(CXXFILES))
INCLUDE = -I/usr/include/dlib-18.18
LIBS = `pkg-config --libs opencv`
CXXFLAGS = `pkg-config --cflags opencv` -w -Wall -Wextra -g -std=c++0x
CFLAGS = `pkg-config --cflags opencv` -g -w
ifdef V
MUTE =
VTAG = -v
else
MUTE = @
endif
all: $(EXE)
# build successful
$(EXE): $(CXXOBJ)
$(CXX) $(CXXOBJ) -o $(EXE) $(LIBS)
$(OBJ_DIR)/%.o: src/%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDE) $< -c -o [email protected]
$(BUILD)
$(OBJ_DIR)/%.o: src/%.c
$(CC) $(CFLAGS) $(INCLUDE) $< -c -o [email protected]
run: all
./$(EXE)
clean:
# Cleaning...
-rm -f $(EXE) $(CXXOBJ)
rmdir bin/
Jetzt bin ich diesen Fehler:
6 of 7
g++ `pkg-config --cflags opencv` -w -Wall -Wextra -g -std=c++0x -I/usr/include/dlib-18.18 src/calib/util/calib_util.cpp -c -o bin/calib/util/calib_util.o
Assembler messages:
Fatal error: can't create bin/calib/util/calib_util.o: No such file or directory
make: *** [bin/calib/util/calib_util.o] Error 1
Ich habe diesen Fehler vorher nicht so weiß nicht, warum es aufkommt. Die Datei ist im Verzeichnis vorhanden. Was soll ich deswegen machen?
Kann ich etwas Code in Makefile einfügen, um das automatisch für mich zu tun, indem ich einfach die src-Ordnerstruktur sehe? –
Schauen Sie [hier] (https://stackoverflow.com/questions/1950926/create-directories-using-make-file). – pushkin
nur noch 1 Frage. Ist es ein guter Weg, diese Zeile zu verwenden: CXXFILES = $ (shell find src -maxdepth 3 -type f -name '* .cpp') oder gibt es einen besseren Weg, es zu tun? –