How to fix error LNK2019 when using videoInput.lib with OpenCv2.1?
-
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.
-
Answer:
I think you still need to link with videoInput.lib, OpenCV uses videoInput.lib but it doesn't mean you can use all functions of videoInput.lib from OpenCV
SKSC at Stack Overflow Visit the source
Other answers
Yes, you have to explicitly link to videoInput.lib from the Linker. http://www.aishack.in/2010/03/capturing-images-with-directx/ you will find what you need.
Rbrto
Here is how you can solve it: "Go to Project Properties -> Confuguration Properties -> Linker -> Input and add videoinput.lib along with the usual OpenCV library files." This is the solution from the site mentioned above. I tried it and it works.
Heitara
Related Q & A:
- How To Fix Blackberry Jvm Error 517?Best solution by Yahoo! Answers
- How To Fix Jvm Error 517 On Blackberry?Best solution by Yahoo! Answers
- How To Fix Error Jvm 517 On Blackberry?Best solution by Yahoo! Answers
- How to fix error printer Canon PIXMA iP1000 error msg The waste in absorber is full. Ink counter i reset?Best solution by Yahoo! Answers
- How to fix error 999?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.