3

I am attempting to compile this code so that I can analyze some images for my job. If there is a good explanation of how this code works, I would appreciate that, but right now I am just trying to get it to compile. I installed opencv (using sudo apt-get install libopencv-dev), but for some reason the file cv.h did not come with it. However, this file must have been previously installed under a random path (/usr/lib/perl/5.14.2/CORE/cv.h) and so I included that one instead. I also included the appropriate highgui.h file which installed normally with opencv. Here are my errors:

/usr/lib/perl/5.14.2/CORE/cv.h:14:5: error: ‘_XPV_HEAD’ does not name a type
/usr/lib/perl/5.14.2/CORE/cv.h:15:5: error: ‘_XPVCV_COMMON’ does not name a type
/usr/lib/perl/5.14.2/CORE/cv.h:16:5: error: ‘I32’ does not name a type
/usr/lib/perl/5.14.2/CORE/cv.h:196:9: error: ‘OP’ does not name a type

I kind of get what these errors mean, and have gotten them in code I have written before, but why am I getting them for code that seems to work for everyone else? Do I need to link something differently? Am using g++/gcc compiler, is something not updated correctly? I installed all recent update son my system... Not sure what else to try. Any thoughts?

Community
  • 1
  • 1
crazygirl9991
  • 41
  • 1
  • 4
  • I guess not all `cv.h` files are created equal: I would be very suspicious of including a header that may not correspond to the library that I have. Anyway, if you included the file as `#include "/usr/lib/perl/5.14.2/CORE/cv.h"`, see if including it as `#include "cv.h"` and adding `-I/usr/lib/perl/5.14.2/CORE` to the compiler flag changes anything. – Sergey Kalinichenko Jun 29 '12 at 16:20
  • That's probably the wrong file. Try `apt-file search cv.h` - you might need to run `apt-file update` first. From [this search](http://packages.ubuntu.com/search?suite=precise&searchon=contents&keywords=cv.h) it looks like you want libcv-dev – Rup Jun 29 '12 at 16:20
  • 1
    Thanks for the tips, guys! That's a cool feature, the apt-file search command. I downloaded libcv-dev, which, like you said, was the reason for the missing header. Now it seems that the files are linking correctly, but I have another error which is moderately frightening, including this type of stuff: /tmp/ccQsAW6d.o: In function `main': c99.cpp:(.text+0x2f): undefined reference to `cvLoadImage'. Not really sure where to begin here, I guess the debugging tag. If you have any ideas let me know, if not thanks for the other help!! – crazygirl9991 Jun 29 '12 at 16:53
  • I can assure you that the perl CORE/cv.h has nothing to do with the Computer Vision cv.h – Jim Balter Jun 29 '12 at 16:55
  • edit: this is still a linking error: collect2: ld returned 1 exit status. Meh. Why won't you give me details g++???? – crazygirl9991 Jun 29 '12 at 17:01
  • "undefined reference to cvLoadImage" - [this page](http://opencv.willowgarage.com/wiki/CompileOpenCVUsingLinux) has some suggestions using pkgconfig – Rup Jun 29 '12 at 17:13
  • cvLoadImage is in the highgui library, so make sure you're using `-lhighgui` – mrh Jun 21 '13 at 14:32

0 Answers0