g++: warning: src/objectDetection.o: linker input file unused because linking not done

编译opecv时候makefile 写出问题

出现g++: warning: src/objectDetection.o: linker input file unused because linking not done


##### Make sure all is the first target.

all:

CXX ?= g++

CC  ?= gcc

CFLAGS  += -g -pthread -Wall 

CFLAGS  += -rdynamic -funwind-tables

#CFLAGS  += -I./include  

#CFLAGS  +=  -I${SDKTARGETSYSROOT}/usr/include/linux-headers/usr/include 

CFLAGS += -D__unused="__attribute__((__unused__))"

LDFLAGS += -L./usr/lib/  # pkg-config opencv --libs --cflags opencv

LDFLAGS += -lopencv_core -ldl -lm -lz

#LDFLAGS += -L./lib/

CFLAGS += -I./usr/include/opencv

CFLAGS += -I./usr/inc/opencv/opencv2

CFLAGS += -I./usr/include  

#LDFLAGS += -L./usr/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab 

#LDFLAGS +=  -lopencv_calib3d   -lopencv_features2d   -lopencv_imgcodecs   -lopencv_ml  -lopencv_objdetect  -lopencv_photo  

#LDFLAGS +=  -lopencv_shape -lopencv_stitching -lopencv_superres  -lopencv_video -lopencv_videostab -lopencv_videoio   -lopencv_highgui

#LDFLAGS += -lIlmImf -llibjasper -llibtiff -llibpng -llibjpeg -llibwebp -lzlib -lopencv_imgproc -lopencv_flann -lopencv_core

#LDFLAGS += -lrt -lpthread -pthread -lm -ldl 

#CXXFLAGS += -c -Wall $(shell pkg-config --cflags opencv)

LDFLAGS += $(shell pkg-config --libs --static opencv)

C_SRC=

#C_SRC+=src/main.c

CXX_SRC=

CXX_SRC +=src/objectDetection.cpp

#CXX_SRC +=src/take_photo.cpp

#CXX_SRC +=src/face_recognition.cpp

OBJ=

DEP=

#LDFLAGS+= -lcamera

OBJ_CAM_SRV = src/objectDetection.o

TARGETS    += object-track

$(TARGETS): $(OBJ_CAM_SRV)

TARGET_OBJ += $(OBJ_CAM_SRV)

FILE_LIST := files.txt

COUNT := ./make/count.sh

MK := $(word 1,$(MAKEFILE_LIST))

ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))

OBJ=$(CXX_SRC:.cpp=.o) $(C_SRC:.c=.o)

DEP=$(OBJ:.o=.d) $(TARGET_OBJ:.o=.d)

CXXFLAGS += -std=c++11 $(CFLAGS)

#include ./common.mk

.PHONY: all clean distclean

all: $(TARGETS)

clean:

    rm -f $(TARGETS) $(FILE_LIST)

    find . -name "*.o" -delete

    find . -name "*.d" -delete

distclean:

    rm -f $(TARGETS) $(FILE_LIST)

    find . -name "*.o" -delete

    find . -name "*.d" -delete

-include $(DEP)

%.o: %.c $(MK) $(ME)

    @[ -f $(COUNT) ] && $(COUNT) $(FILE_LIST) $^ || true

    @$(CC) -c $< -MM -MT $@ -MF $(@:.o=.d) $(CFLAGS) $(LIBQCAM_CFLAGS)

    $(CC) -c $< $(CFLAGS) -o $@ $(LIBQCAM_CFLAGS)

%.o: %.cpp $(MK) $(ME)

    @[ -f $(COUNT) ] && $(COUNT) $(FILE_LIST) $^ || true

    @$(CXX) -c $< -MM -MT $@ -MF $(@:.o=.d) $(CXXFLAGS)

    $(CXX) -c $< $(CXXFLAGS) -o $@

$(TARGETS): $(OBJ)

    $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)

    @[ -f $(COUNT) -a -n "$(FILES)" ] && $(COUNT) $(FILE_LIST) $(FILES) || true

    @[ -f $(COUNT) ] && $(COUNT) $(FILE_LIST) || true

将CXXFLAGS 用#注释掉 可能跟CXFLGS冲突所致。


sitemap