2013-02-10 60 views
0

我需要使用它具有FUNC deviceSetupWithSubtype() (这不是原来的videoInput库)如何编译修改videoInput.h

我在rar.h.cpp在最后的修改videoInput库本页面: http://opencv.willowgarage.com/wiki/CameraCapture

我试图与VC2010快递C++编译它,我有我的.lib,但是当我把它放在我想用修改后的videoInput.h程序,我得到一个很多LNK错误,如:

videoInput.lib(videoInput.obj) :error LNK2001: unresolved external symbol [email protected] 

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 

(我也尝试了正常的videoInput.lib,它运行良好,但它不是我需要的版本)。

我该如何解决这个问题? 或者如果你只是有这个修改videoInput.lib,你可以上传它? 谢谢。

编辑:

在释放模式,我得到的也是这个错误:

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

你有一个无法解析的外部符号,这意味着你没有链接你应该链接的东西。尝试使用源代码附带的makefile构建它。 – StoryTeller 2013-02-10 17:25:16

+0

我没有makefile的经验,无论如何我搜索了一些东西,所以我从控制台做了:nmake -f Makefile.win,但是我得到这个错误:makefile.win(24):致命错误U1001:语法错误:非法字符' {'在macroStop中。 – frank10 2013-02-10 21:25:10

+0

在一个文件夹中有这些文件:makefile.win videoInputLib.a videoInputLib.dev和videoInputLib.layout在另一个文件夹中有videoInput.cpp videoInput.h和videoInput.o – frank10 2013-02-10 21:30:06

回答

1

很多搜​​索上我与许多库尝试链接错误,在结束后,我找到了解决办法: 必须在videoInput.h添加这些线(在连接最终调整的路径,我并不需要它):

// 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") 

现在得到的videoInput.lib正确编译。