# VideoCapture compile error

**URL:** <https://forum.opencv.org/t/videocapture-compile-error/4188>\
**Category:** Uncategorized\
**Tags:** build\
**Created:** [July 6, 2021, 6:37am UTC](https://forum.opencv.org/t/videocapture-compile-error/4188 "2021-07-06T06:37:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john7](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@john7](https://forum.opencv.org/u/john7)\
**Post date:** [July 6, 2021, 6:37am UTC](https://forum.opencv.org/t/videocapture-compile-error/4188/1 "2021-07-06T06:37:56Z")

</div>

My code in Qt

```auto
LIBS += -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lopencv_highgui

#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/core/utility.hpp>

using namespace cv;

Mat frame;
VideoCapture cap = VideoCapture(0);
 while(1)
{
     //cap.read(frame);
    cap>>frame;
    imshow("image", frame);
 }

```

When I build I get

> /usr/bin/ld: main.o: undefined reference to symbol ‘\_ZN2cv12VideoCaptureD1Ev’  
> /usr/bin/ld: //usr/lib/arm-linux-gnueabihf/libopencv\_videoio.so.3.2: error adding symbols: \>DSO missing from command line  
> collect2: error: ld returned 1 exit status

What may be a problem?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [July 6, 2021, 6:43am UTC](https://forum.opencv.org/t/videocapture-compile-error/4188/2 "2021-07-06T06:43:28Z")

</div>

same problem as in your last question – you’re missing a library

```
-lopencv_videoio

```

also, for clarity, you should

```
#include <opencv2/videoio.hpp>

```

explicitly (it’s still in the highgui header for historic reasons)

(rule of thumb - you need a library for each module header you include …)

---

<div class="post-metadata">

**Author:** ![john7](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@john7](https://forum.opencv.org/u/john7)\
**Post date:** [July 6, 2021, 6:45am UTC](https://forum.opencv.org/t/videocapture-compile-error/4188/3 "2021-07-06T06:45:47Z")

</div>

Thank you so much! )
