对'cv::VideoCapture::VideoCapture(int)的未定义引用
undefined reference to `cv::VideoCapture::VideoCapture(int)
当我尝试启动计算机相机时,我遇到了这个问题。 我正在使用此代码
#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 的新手,请帮忙。
就我而言,我可以通过向g++
编译器添加-lopencv_videoio
来解决此问题。
相关文章:
- 在没有未定义行为的情况下实现类似std::vector的容器
- 将帧从python VideoCapture()传递给c ++
- 如何在 opencv 中使用 cv::VideoCapture::waitAny()
- 为什么"std::uninitialized_copy"通常取消对未初始化内存的迭代器的引用不是未定
- Qt 错误:QSqlQuery::value:尝试从表中检索统计信息时未定位在有效记录上 (QComboBox)
- 返回未定义行为的递归行列式函数
- 为不应该获得未定义行为的内容获取未定义的行为
- 使用联合时未定义行为的情况
- 在没有未定义行为的情况下,将浮点缓冲区重新用于双打
- 对'cv::VideoCapture::VideoCapture(int)的未定义引用
- 迭代器和标量对象之间的未定义行为有什么区别吗?
- 未定向到相机的粒子
- 无法找到未定义行为的原因
- 包含未定义行为的源代码使编译器崩溃是否合法?
- OpenCV VideoCapture Partial Frame Corruption
- 了解未定义行为的范围
- OpenCV VideoCapture 无法打开文件,我做错了什么?
- 使与同一数组无关的两个指针减去未定义行为的基本原理是什么?
- 使用引用不会导致有关未定义行为的警告
- 使用具有未定义行为的 (STL) 复制