OpenCV problem

Hi, I download and install OpenCV 3.1, but when I want to start a code it wrote me back this

CMakeFiles/camera.dir/camera.c.o: In function `cvPointFrom32f':
camera.c:(.text+0x7a4): undefined reference to `cvRound'
camera.c:(.text+0x7bc): undefined reference to `cvRound'
CMakeFiles/camera.dir/camera.c.o: In function `cvReadInt':
camera.c:(.text+0x1378): undefined reference to `cvRound'
CMakeFiles/camera.dir/camera.c.o: In function `cvEllipseBox':
camera.c:(.text+0x169c): undefined reference to `cvRound'
camera.c:(.text+0x16bc): undefined reference to `cvRound'
collect2: ld returned 1 exit status
CMakeFiles/camera.dir/build.make:113: recipe for target 'camera' failed
make[2]: * [camera] Error 1
CMakeFiles/Makefile2:63: recipe for target 'CMakeFiles/camera.dir/all' failed
make[1]: * [CMakeFiles/camera.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
make: * [all] Error 2

Please, does anyone know what to do to solve that? :) 

You haven’t included what

You haven’t included what code you are trying to compile or what actions you did to get where you are so it is pretty hard to even wildly guess what is the problem.  I don’t know if you are on Linux, Windows or Mac, if you are using an IDE or from a command prompt, what tutorial you used, etc etc.  

From your snippet, the compiler is looking for the function cvRound, cvEllipseBox, and cvReadInt but you either haven’t included a header file, a library or maybe a path to those files.  Two million reasons and counting why it can’t find them…

Regards,

Bill 

code

Hi, thanks for answering, I apologise for not including the code. I did everything like him (the man in the video). But in the end it wrote me back this, so I dont know what to do. All of that was start/code/compile…etc…in command line on Raspberry pi 2.

Code is here -> 

#include “highgui.h”
int main(void)
{
cvNamedWindow
(“Demo”, CV_WINDOW_AUTOSIZE);
cvCapture
capture = cvCreateCameraCapture(0);
IplImage frame;
while(1)
{
frame
= cvQueryFrame(capture);
if(!frame)break;
cvShowImage
(“Demo”,frame);
char c = cvWaitKey(33);
if(c==27)break;
}
cvReleaseCapture
(&capture);
cvDestroyWindow
(“Demo”);
return 0;
}

Error message ->

CMakeFiles/camera.dir/camera.c.o: In function cvPointFrom32f': camera.c:(.text+0x7a4): undefined reference to cvRound
camera.c:(.text+0x7bc): undefined reference to cvRound'</span><span class="pln" style="color: #000000;"> </span><span class="typ" style="color: #660066;">CMakeFiles</span><span class="pun" style="color: #666600;">/</span><span class="pln" style="color: #000000;">camera</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: #000000;">dir</span><span class="pun" style="color: #666600;">/</span><span class="pln" style="color: #000000;">camera</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: #000000;">c</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: #000000;">o</span><span class="pun" style="color: #666600;">:</span><span class="pln" style="color: #000000;"> </span><span class="typ" style="color: #660066;">In</span><span class="pln" style="color: #000000;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: #000000;"> </span><span class="str" style="color: #008800;">cvReadInt’:
camera.c:(.text+0x1378): undefined reference to </span><span class="pln" style="color: #000000;">cvRound</span><span class="str" style="color: #008800;">' CMakeFiles/camera.dir/camera.c.o: In function cvEllipseBox’
:
camera
.c:(.text+0x169c): undefined reference to cvRound' camera.c:(.text+0x16bc): undefined reference to cvRound
collect2: ld returned 1 exit status
CMakeFiles/camera.dir/build.make:113: recipe for target ‘
camera’ failed
make[2]: * [camera] Error 1
CMakeFiles/Makefile2:63: recipe for target ‘
CMakeFiles/camera.dir/all’ failed
make[1]: * [CMakeFiles/camera.dir/all] Error 2
Makefile:75: recipe for target ‘
all’ failed
make: * [all] Error 2

I used this tutorial - https://www.youtube.com/watch?v=_DMqGTsEo30

I use a Linux box, but it

I use a Linux box, but it isn’t a RasPi.  I won’t be able to help you really with this since my setup is completely different.  You are probably running different version of Linux (I am on Ubuntu vs. Raspian) etc.  I installed OpenCV through ROS and it was very straight forward, absolutely no problems.  Which doesn’t help you a bit here…

It seems the guy who did the video is pretty responsive.  I suggest you go through his answers to questions on the video page to make sure he hasn’t answered to your issue.  One answer that jumped out is you need to have root access to get to all of the files so that might be your problem  Try sudo make to see if that solves your issue.  He also has some updated libraries which you need to go to his website and get.  I just wanted to make sure you didn’t miss that.  Raspberrypi.org might be a good resource on this as well.

Sorry to not be more helpful.  Maybe someone else here has done this on their Pi and can speak to it directly. Good luck.

Regards,

Bill

thanks

thanks for answer, I change a bit my code and try displey image, and it works! But it also wrote me back this one error sentace -

Xlib: extension “RANDR” missing on display “:1.0”.

 

…Now I update my code to capture video, but now I have this error message 

Xlib:  extension “RANDR” missing on display “:1.0”.

libv4l2: error setting pixformat: Device or resource busy

VIDEOIO ERROR: libv4l unable to ioctl S_FMT

libv4l2: error setting pixformat: Device or resource busy

libv4l1: error setting pixformat: Device or resource busy

VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT