在发布模式下出错,但在构建模式下没有

时间:2011-07-27 18:06:57

标签: c++ visual-studio-2008 visual-c++ opencv

我最近在visual 2008中使用opencv和c ++创建了一个项目 当我在调试模式下构建项目时 - 我没有遇到任何问题 - 但是当我在发布模式下构建它时,我得到以下错误:

1>test.obj : error LNK2001: unresolved external symbol _cvHaarDetectObjects
1>test.obj : error LNK2001: unresolved external symbol _cvCvtColor
1>test.obj : error LNK2001: unresolved external symbol _cvCreateImage
1>test.obj : error LNK2001: unresolved external symbol _cvDestroyWindow
1>test.obj : error LNK2001: unresolved external symbol _cvWaitKey
1>test.obj : error LNK2001: unresolved external symbol _cvGetSize
1>test.obj : error LNK2001: unresolved external symbol _cvReleaseCapture
1>test.obj : error LNK2001: unresolved external symbol _cvCreateMemStorage
1>test.obj : error LNK2001: unresolved external symbol _cvClone
1>test.obj : error LNK2001: unresolved external symbol _cvNamedWindow
1>test.obj : error LNK2001: unresolved external symbol _cvQueryFrame
1>test.obj : error LNK2001: unresolved external symbol _cvLoad
1>test.obj : error LNK2001: unresolved external symbol _cvRectangle
1>test.obj : error LNK2001: unresolved external symbol _cvCreateCameraCapture
1>test.obj : error LNK2001: unresolved external symbol _cvGetSeqElem
1>test.obj : error LNK2001: unresolved external symbol _cvShowImage

3 个答案:

答案 0 :(得分:11)

检查链接器 - >输入 - >发布配置中的附加依赖关系设置;毫无疑问,你忘了包含OpenCV库。只需从Debug配置中复制粘贴它们,但不要忘记删除d后缀。

E.g。 cv210.lib:发布模式和cv210d.lib:调试模式。

答案 1 :(得分:2)

您未在调试版本中包含的发布版本中包含相同的库。 “未解析的外部符号”表示无法找到您正在引用的函数的实现。

答案 2 :(得分:0)

当您将附加依赖项提供给调试模式而不是发布时,会发生这种情况。

相关问题