您的位置:首页 > 运维架构

使用g++编译OpenCV程序

2013-06-21 10:51 274 查看
源码:

#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/opencv.hpp>
#include <math.h>
using namespace cv;
using namespace std;
int main()
{
Mat a;
return 1;
}


Makefile:

main: reg.cpp
g++  -o ${@} $<  `pkg-config opencv --cflags --libs `


注意,g++语句一定要按照如上顺序来,pkg-config  opencv --flags --libs(依赖文件) 一定要放在后面。(放在前面的话会出现莫名奇妙的错误

pkg-config的解释见博文:PKG_CONFIG_PATH变量 与 ld.so.conf 文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐