frank10
frank10

Reputation: 57

how to compile a modified videoInput.h

I need to use the modified videoInput library which has the func deviceSetupWithSubtype() (It's not the original videoInput library)

I got the .h and .cpp in the rar at the end of this page: http://opencv.willowgarage.com/wiki/CameraCapture

I tried to compile it with VC2010 Express C++, and I got my .lib, but when I put it in the program in which I want to use the modified videoInput.h, I get a lot of LNK errors such as:

videoInput.lib(videoInput.obj) :error LNK2001:  unresolved external symbol __imp__CoTaskMemFree@4 

videoInput.lib(videoInput.obj) :error LNK2001:  unresolved external symbol _MEDIASUBTYPE_RGB24 

videoInput.lib(videoInput.obj) :error LNK2001:  unresolved external symbol _MEDIASUBTYPE_AYUV 

videoInput.lib(videoInput.obj) :error LNK2001:  unresolved external symbol _MEDIASUBTYPE_Y211 

(I tried also the normal videoInput.lib and it works well, but it's not the version I need).

How can I solve that? Or if you just have this modified videoInput.lib, could you upload it? Thank you.

EDIT:

In release mode, I get also this error:

videoInput.lib(videoInput.obj) : error LNK2038: mismatch detected for  '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' 

Upvotes: 0

Views: 662

Answers (1)

frank10
frank10

Reputation: 57

After a lot of searching on the link errors I tried with many libs, at the end I found the solution: you must add these lines in videoInput.h (eventually adjust the paths in the linker, I didn't need it):

// if gives error LNK2038: mismatch detected for   '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
// insert _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH in the C++ preprocessor option in the project properties
// these are the library needed:
#pragma comment (lib, "oleaut32")
#pragma comment (lib, "ole32")
#pragma comment (lib, "user32")
#pragma comment (lib, "strmbase")

Now the resulting videoInput.lib compiles correctly.

Upvotes: 1

Related Questions