Mergevec.obj:10个未解决的链接错误(用于haartraining的OpenCV样本收集)



在本教程中,我尝试合并使用opencv_createsamples创建的不同向量,以便我可以进行一些haartraining。

我正在使用VS 2010命令行界面编译mergevec.cpp:

cl /EHsc mergevec.cpp

但是我在这里收到 10 个未解决的外部错误:

/out:mergevec.exe
mergevec.obj
mergevec.obj : error LNK2019: unresolved external symbol _cvFree_ referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvReleaseMat referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvWaitKey referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int*,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvShowImage referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol "void __cdecl icvWriteVecSample(struct _iobuf *,void *)" (?icvWriteVecSample@@YAXPAU_iobuf@@PAX@Z) referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol "int __cdecl icvGetHaar
TraininDataFromVecCallback(struct CvMat *,void *)" (?icvGetHaarTraininDataFromVecCallback@@YAHPAUCvMat@@PAX@Z) referenced in function "void __cdecl icvAppendVec (struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvV
ecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvCreateMat referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvAlloc referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *, int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvNamedWindow referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec@@YAXAAUCvVecFile@@0PAHHH@Z)
mergevec.obj : error LNK2019: unresolved external symbol "void __cdecl icvWriteV
ecHeader(struct _iobuf *,int,int,int)" (?icvWriteVecHeader@@YAXPAU_iobuf@@HHH@Z)  referenced in function "void __cdecl icvMergeVecs(char *,char const *,int,int,int)" (?icvMergeVecs@@YAXPADPBDHHH@Z)
mergevec.exe : fatal error LNK1120: 10 unresolved externals

如何解决这些问题?我需要获取一些 .dll 吗?2 天来,我一直在努力让 mergevec 在不同的机器上工作!问题是这是旧的吗?

顺便说一下,我将代码中的所有引用从 "cv.h" 更改为 "opencv.h" ,因为这是当前头文件的名称。

我正在尝试在具有以下结构的文件夹中编译mergevec.cpp

  opencv/
  opencv2/
CMakeLists.txt
createsamples.cpp
cvboost.cpp
cvclassifier.h
cvcommon.cpp
cvhaarclassifier.cpp
cvhaartraining.cpp
cvhaartraining.h
cvsamples.cpp
cxcore.h
cxmisc.h
haartraining.cpp
mergevec.cpp
opencv.hpp
performance.cpp
_cvcommon.h
_cvhaartraining.h

文件夹opencv2有目录:core, highgui, flann, contrib等。

编辑

根据您的评论,我更改了命令以包含库:

cl /EHsc mergevec.cpp 
C:opencvbuildx64vc10libopencv_core247d.lib 
C:opencvbuildx64vc10libopencv_highgui247d.lib 
C:opencvbuildx64vc10libopencv_flann247d.lib 
C:opencvbuildx64vc10libopencv_imgproc247d.lib

但它仍然显示相同的 10 个未解决的外部。在绝望中,我什至尝试包括每个库文件,但没有区别。

Visual Studio似乎找不到OpenCV库,这似乎是一个pkg-config缺失的问题。检查这一点,因为我不确定它在 Windows 上的工作方式。您是否在项目属性中链接了 OpenCV 库?

否则,如果它仍然无法在VS上运行,我建议您在Linux(WM与否)下编译它。查看这篇文章以获取更多信息。

相关内容

  • 没有找到相关文章

最新更新