简体   繁体   English

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

[英]Error in Release mode but not in Build mode

I recently made a project using opencv and c++ in visual 2008 When i build the project in Debug mode - i don't face any issues - but when i build it in release mode i get the following errors: 我最近在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

Check Linker->Input->Additional Dependencies settings in the Release configuration ; 检查Release配置中的Linker-> Input-> Additional Dependencies设置; you have undoubtedly forgotten to include the OpenCV libraries. 毫无疑问,你忘了包含OpenCV库。 Just copy-paste them from the Debug configuration, but don't forget to remove the d suffix. 只需从Debug配置中复制粘贴它们,但不要忘记删除d后缀。

Eg cv210.lib : Release mode and cv210d.lib : Debug mode. 例如cv210.lib :发布模式和cv210d.lib :调试模式。

You are not including the same libraries in your release build that you include in your debug build. 您未在调试版本中包含的发布版本中包含相同的库。 "unresolved external symbol" means it cannot find the implementation for a function you are referencing. “未解析的外部符号”表示它无法找到您正在引用的函数的实现。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM