tags:

views:

208

answers:

0

Hello everyone,I am new in OpenCV and have some problems when using videoInput.lib,please help me.I am using winXP SP3+Cmake2.8.2+OpenCV 2.1+Visual Studio 2008.I have made every configuration and now OpenCv can be used when I am coding.I heard videoInput.lib has been included since OpenCV2.0 and I want to use it,so I tried codes below to quick test.


// Test2.cpp : Defines the entry point for the console application. //

#include "videoInput.h"
#include "stdafx.h"       
#include "cv.h"    
#include "highgui.h"  
#include "cxcore.h"

int main(int ,char * *) {

int width=320;

int height=240;

IplImage *pRgb=cvCreateImage(cvSize(width,height), IPL_DEPTH_8U, 3);

videoInput video;

video.setupDevice(0, width, height);

video.showSettingsWindow(0);

while(1)

{ if(video.isFrameNew(0))

{ video.getPixels(0, (unsigned char *)pRgb->imageData, false, true);

    //cvFlip(pRgb,NULL,1);

    char c=cvWaitKey(1);

    if(c==27) break;

    cvShowImage("Video", pRgb);

} } }


However when I build the codes,I got following error

1>------ Build started: Project: Test2, Configuration: Debug Win32 ------

1>Compiling...

1>Test2.cpp

1>c:\opencv2.1\vc2008\include\opencv\cvcompat.h(803) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss

1>Linking...

1>Test2.obj : error LNK2019: unresolved external symbol "public: __thiscall videoInput::~videoInput(void)" (??1videoInput@@QAE@XZ) referenced in function _main

1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::getPixels(int,unsigned char *,bool,bool)" (?getPixels@videoInput@@QAE_NHPAE_N1@Z) referenced in function _main

1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::isFrameNew(int)" (?isFrameNew@videoInput@@QAE_NH@Z) referenced in function _main

1>Test2.obj : error LNK2019: unresolved external symbol "public: void __thiscall videoInput::showSettingsWindow(int)" (?showSettingsWindow@videoInput@@QAEXH@Z) referenced in function _main

1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::setupDevice(int,int,int)" (?setupDevice@videoInput@@QAE_NHHH@Z) referenced in function _main

1>Test2.obj : error LNK2019: unresolved external symbol "public: __thiscall videoInput::videoInput(void)" (??0videoInput@@QAE@XZ) referenced in function _main

1>C:\Documents and Settings\SKSC\My Documents\Visual Studio 2008\Projects\Test2\Debug\Test2.exe : fatal error LNK1120: 6 unresolved externals 1>Build log was saved at "file://c:\Documents and Settings\SKSC\My Documents\Visual Studio 2008\Projects\Test2\Test2\Debug\BuildLog.htm"

1>Test2 - 7 error(s), 1 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I have been googling for a long time but still can not find the solution,I am gonna mad.Does anyone know how to fix these problems? Thanks in advance.