1

I am trying to run simple display image program using opencv2.4.9 on fedora 18.

Here's my code:

#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;
   }

When I run using gcc image1.c -o image I am getting the error:

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.

Also I have tried

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

But it is giving me same error.It has some library linking issue.As I am not much aware about fedora opencv please guide me in this case. Please guide me for this issue.

Sourav Ghosh
  • 133,132
  • 16
  • 183
  • 261
princess
  • 11
  • 2
  • 1
    Check out the following link: http://stackoverflow.com/questions/10181947/not-able-to-link-to-shared-library-of-opencv-linux – OshoParth Oct 27 '14 at 09:57
  • @OshoParth Thanx. But I tried using that link but its is still giving me this error: gcc image1.c -o image -I /usr/local/include/opencv/ -L/usr/local/lib/ -lm -lhighgui -lcv /bin/ld: cannot find -lhighgui /bin/ld: cannot find -lcv collect2: error: ld returned 1 exit status – princess Oct 27 '14 at 10:09
  • Okz I was reading for the errors you got and found another link check this one http://stackoverflow.com/questions/14416487/gcc-usr-bin-ld-error-cannot-find-lncurses – OshoParth Oct 27 '14 at 10:12
  • That is for ubuntu and i am working on fedora. And the same issue persists. – princess Oct 27 '14 at 10:36

1 Answers1

0

Compile using the following command:

gcc image1.c -o image `pkg-config --cflags --libs opencv` 
naktinis
  • 3,957
  • 3
  • 36
  • 52
Munesha
  • 9
  • 3