make: *** No rule to make target hide_pic.h', needed by hideqr.o'. Stop

Viewed 14

When I write Makefile below, It went run,how to solve?

hideqr.o : hide_pic.cpp hide_pic.h  
    g++ ${CPP_FLAGS} -c $< -I/home/wangxiaofei01/hideqr/hideqr/hideqr/include -o $@
1 Answers

First, chechout if the file of hide_pic.h has the common dir path with Makefile, if not, then change hideqr.o : hide_pic.cpp hide_pic.h to hideqr.o : hide_pic.cpp, then use -I option to specify hide_pic.h path; The example is below;

HDIEQR_ROOT:=$(shell cd ../../.. && pwd)
HIDEQR_INCLUDE = -I$(HDIEQR_ROOT)/hideqr/hideqr/include
$(warning $(HIDEQR_INCLUDE)) # -I/home/wangxiaofei01/hideqr/hideqr/hideqr/include
hideqr.o : hide_pic.cpp
    g++ ${CPP_FLAGS} -c $< $(HIDEQR_INCLUDE) -o $@

Related