zoukankan      html  css  js  c++  java
  • makefile for opencv

    makefile

    ####################################################
    # Generic makefile - 万能Makefile
    # for compiling and linking C++ projects on Linux 
    # Author: George Foot  Modified:Jackie Lee
    ####################################################
    ### Customising
    #
    # Adjust the following if necessary; EXECUTABLE is the target
    # executable's filename, and LIBS is a list of libraries to link in
    # (e.g. alleg, stdcx, iostr, etc). You can override these on make's
    # command line of course, if you prefer to do it that way.
    #
    #
    EXECUTABLE := main    # 可执行文件名
    LIBDIR:=  /usr/local/lib/            # 静态库目录
    #LIBS :=  opencv_core            # 静态库文件名
    LIBS :=  -lopencv_highgui  -lopencv_core            # 静态库文件名
    INCLUDES:=/home/wang/Downloads/opencv-2.4.9/include , /home/wang/Downloads/opencv-2.4.9/include/opencv           # 头文件目录
    SRCDIR:=              # 除了当前目录外,其他的源代码文件目录
    #
    # # Now alter any implicit rules' variables if you like, e.g.:
    
    CC:=g++
    CFLAGS := -g -Wall -O3
    CPPFLAGS := $(CFLAGS)
    CPPFLAGS += $(addprefix -I,$(INCLUDES))
    CPPFLAGS += -MMD
    #
    # # The next bit checks to see whether rm is in your djgpp bin
    # # directory; if not it uses del instead, but this can cause (harmless)
    # # `File not found' error messages. If you are not using DOS at all,
    # # set the variable to something which will unquestioningly remove
    # # files.
    #
    
    RM-F := rm -f
    
    
    # # You shouldn't need to change anything below this point.
    #
    SRCS := $(wildcard *.cpp) $(wildcard $(addsuffix /*.cpp, $(SRCDIR)))
    OBJS := $(patsubst %.cpp,%.o,$(SRCS))
    DEPS := $(patsubst %.o,%.d,$(OBJS))
    MISSING_DEPS := $(filter-out $(wildcard $(DEPS)),$(DEPS))
    MISSING_DEPS_SOURCES := $(wildcard $(patsubst %.d,%.cpp,$(MISSING_DEPS)))
    
    
    .PHONY : all deps objs clean veryclean rebuild info
    
    all: $(EXECUTABLE)
    
    deps : $(DEPS)
    
    objs : $(OBJS)
    
    clean :
        @$(RM-F) *.o
        @$(RM-F) *.d
    veryclean: clean
        @$(RM-F) $(EXECUTABLE)
    
    rebuild: veryclean all
    ifneq ($(MISSING_DEPS),)
    $(MISSING_DEPS) :
        @$(RM-F) $(patsubst %.d,%.o,$@)
    endif
    -include $(DEPS)
    $(EXECUTABLE) : $(OBJS)
        $(CC) -o $(EXECUTABLE) $(OBJS) $(addprefix -L,$(LIBDIR)) $(LIBS) #$(addprefix -l,$(LIBS))
    
    info:
        @echo $(SRCS)
        @echo $(OBJS)
        @echo $(DEPS)
        @echo $(MISSING_DEPS)
        @echo $(MISSING_DEPS_SOURCES)

    cpp file

    #include <cv.h>
    
    #include <highgui.h>
    
    using namespace std;
    
    int main()
    
    {
    
    IplImage * test;
    
    test = cvLoadImage("/home/wang/Desktop/1.png");//图片路径
    
    cvNamedWindow("test_demo", 1);
    
    cvShowImage("test_demo", test);
    
    cvWaitKey(0);
    
    cvDestroyWindow("test_demo");
    
    cvReleaseImage(&test);
    
    return 0;
    
    }
  • 相关阅读:
    java-实现两种排序方法
    暑假,一遍一遍敲代码吧!
    java学习-如何定义一个函数及其简单练习
    关于函数重载的理解
    java学习中关于函数的练习
    在校大三学生,真心想学好计算机。可是,,,,没有目标,。。。。。。
    伪分布式网络爬虫框架的设计与自定义实现(一)
    网站架构成长路程之 箴言
    使用asp.net mvc + entityframework + sqlServer 搭建一个简单的code first项目
    使用visualStudio2017创建一个简单的控制台程序
  • 原文地址:https://www.cnblogs.com/Wanggcong/p/4789429.html
Copyright © 2011-2022 走看看