使用gcc时在opencv库中链接错误

时间:2014-10-27 09:39:49

标签: c linux opencv fedora

我正在尝试使用fedora 18上的opencv2.4.9运行简单的显示图像程序。

这是我的代码:

#include<stdio.h>
#include<stdlib.h>

#include<opencv/cvaux.h>
#include<opencv/highgui.h>
#include<opencv/cxcore.h>
#include<opencv/cv.h>



int main()
   {
    IplImage* img = cvLoadImage("/home/tel/fruits.jpg",CV_LOAD_IMAGE_COLOR);
    cvNamedWindow("opencvtest",CV_WINDOW_AUTOSIZE);
       cvShowImage("opencvtest",img);
    cvWaitKey(0);
    cvReleaseImage(&img);// relaese img
    return 0;
   }

当我使用gcc image1.c -o image运行时,我收到错误:

In file included from /usr/local/include/opencv/cvaux.h:54:0,
             from image1.c:4:
 /usr/local/include/opencv2/video/background_segm.hpp:47:16: fatal error: list:No       such file or directory
 compilation terminated.

我也试过

  gcc image1.c -o image -L/usr/local/lib

但它给了我同样的错误。它有一些库连接问题。由于我不太了解fedora opencv,请在这种情况下指导我。请指导我解决这个问题。

1 个答案:

答案 0 :(得分:0)

使用以下命令编译:

"bower": "^1.4.1",
"grunt": "^0.4.5",
"grunt-concurrent": "^2.0.3",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.1.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-imagemin": "^1.0.1",
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-uglify": "^0.9.2",
"grunt-contrib-watch": "^1.0.0",
"grunt-scp": "^0.1.8",
"grunt-sftp-deploy": "^0.2.4",
"grunt-text-replace": "^0.4.0",