这个问题已经在这里有一个答案:
- 什么是未定义参考/解析的外部符号错误,我该如何解决? 32个回答
我想不通为什么我recieving这个错误。 任何人都可以伸出援助之手。 我需要声明VideoCapture捕获在头文件并调用它在Video.cpp
Video.h
class Video
{
public:
static VideoCapture capture;
//Default constructor
Video();
//Declare a virtual destructor:
virtual ~Video();
//Method
void Start();
private:
};
Video.cpp
#include "StdAfx.h"
#include "Video.h"
#include "UserInfo.h"
#include "Common.h"
void Video::Start()
{
while(1)
{
Mat img;
bool bSuccess = capture.read(img); // read a new frame from video
if (!bSuccess) //if not success, break loop
{
cout << "End of video" << endl;
break;
}
imshow("original video", img); //show the frame in "Original Video" window
if(waitKey(30) == 27) //wait for 'esc' key press for 30 ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
}
任何帮助将不胜感激