【问题标题】:undefined reference to `cv::VideoCapture::VideoCapture(int)对 `cv::VideoCapture::VideoCapture(int) 的未定义引用
【发布时间】:2018-02-02 16:59:45
【问题描述】:

我在尝试启动计算机摄像头时遇到了这个问题。 我正在使用此代码

#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include "opencv2/videoio.hpp"

using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
    VideoCapture cap(0); // open the video camera no. 0

}

它显示了这个错误

enter code here
make all 
Building target: video
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "video"  ./yes.o   -lopencv_video
./yes.o: In function `main':
/home/allofthepower/eclipse-workspace/video/Debug/../yes.cpp:10: undefined reference to `cv::VideoCapture::VideoCapture(int)'
makefile:44: recipe for target 'video' failed
/home/allofthepower/eclipse-workspace/video/Debug/../yes.cpp:10: undefined reference to `cv::VideoCapture::~VideoCapture()'
collect2: error: ld returned 1 exit status
make: *** [video] Error 1

我是 Ubuntu 和 OpenCV 的新手,请帮忙。

【问题讨论】:

标签: c++ eclipse opencv gcc


【解决方案1】:

就我而言,我可以通过将-lopencv_videoio 添加到g++ 编译器来解决此问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    • 1970-01-01
    • 2020-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多