[Solved] Linking error: undefined reference to `cv::VideoCapture::open(std::string const&)` [closed]

asked 2013-06-06 08:58:10 -0600

Michał Rus gravatar image

updated 2013-06-06 10:42:25 -0600

I'm trying to use an .avi file as my source. (Camera capture already works.) My project compiles without problems, but during linking I get the error:

undefined reference to 'cv::VideoCapture::open(std::string const&)'

What should I do? In which library is this std::string overload of VideoCapture::open() put?

Edit: VideoCapture(0) (camera capture) compiles, links and works, so VideoCapture(std::string) has to be somewhere else that in libs I'm already linking with... right?

Edit: OpenCV version: 2.4.9 (cloned from git yesterday).

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-03 08:15:45.019649

Comments

opencv version ?

berak gravatar imageberak ( 2013-06-06 09:08:10 -0600 )edit

@berak Newest from git: 2.4.9.

Michał Rus gravatar imageMichał Rus ( 2013-06-06 09:09:39 -0600 )edit

hmm, that's CV_WRAP virtual bool open(const String& filename); here (2.4.9, pulled a week ago)

note: cv::String instead of std::string

berak gravatar imageberak ( 2013-06-06 09:17:23 -0600 )edit

@berakcv::String x("V:/DATA/320.AVI"); capture.open(x); instead of capture.open("V:/DATA/320.AVI"); renders the same error... cv::String is std::string.

Michał Rus gravatar imageMichał Rus ( 2013-06-06 09:23:44 -0600 )edit

cv::String != std::string ( core/cvstd.hpp L 230 )

i'm puzzled, where the std:string comes from

berak gravatar imageberak ( 2013-06-06 09:27:11 -0600 )edit

any chance, you got older(2.4.x) libs lying around ?

berak gravatar imageberak ( 2013-06-06 09:35:26 -0600 )edit

@berak Oh, dear God. I'm using headers from 2.4.5... But where are the headers from 2.4.9? I used CMake to compile it.

Michał Rus gravatar imageMichał Rus ( 2013-06-06 09:40:17 -0600 )edit

hehe, good to hear that.

if you ran the INSTALL project, they should be in build/include, or maybe in build/install/include

berak gravatar imageberak ( 2013-06-06 09:43:01 -0600 )edit

@berak Ok, I've run make install, for some reason it also rebuilded some part of it... But it works. Thank you! Next problem is that capture >> frame; causes the program to crash... but at least it starts. ;p

Michał Rus gravatar imageMichał Rus ( 2013-06-06 10:35:30 -0600 )edit

check cap.isOpened() before.

and, maybe edit the title of this question, and add [Solved] ?

berak gravatar imageberak ( 2013-06-06 10:38:05 -0600 )edit