opencv项目报错_pFirstBlock==pHead解决办法

备注:

我上次遇到这个问题的原因是项目设置为MTd导致的

OpenCV是MTd的,我要是改成MDd就编译报错,所以不能采用把项目改为MDd的办法,只能把OpenCV重新编译为MDd的,下载CMAKE,打开OPENCV的sources,把CMakeLists.txt打开,搜索BUILD_WITH_STATIC_CRT,把ON IF MSVC改为OFF IF MSVC,然后用CMAKE重新编译。
注意编译出来之后的build目录下有个lib要加入链接器目录,然后build3rdpartylib也要加入链接器目录
头文件还是就用官方放出的build里面的include文件夹

======================================================

转自:http://blog.csdn.net/qq_15947787/article/details/53101728

遇到调试错误:Expression: _pFirstBlock==pHead。查阅了好久不知道是什么原因。最后发现是工程设置问题。现已经解决了。

----------》debug版下:属性--配置属性--C/C++--代码生成--运行库:
Multi-threaded Debug DLL (/MDd)

1>e:visual studiovcatlmfcincludeafx.h(24): fatal error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

----------》工程->属性- >配置属性->c++->命令行
结尾加上
/D "_AFXDLL" 

以上转自http://blog.csdn.net/u013346007/article/details/51638320

For unknown reasons, some versions of OpenCV (2.x at least) have a CMake variable "BUILD_WITH_STATIC_CRT" that by default gets set to on, thus causing issues like that. Disable that flag, then the solution should get generated with /MDd defined.

Secondarily, open your exe file in dependency walker. Look for multiple versions of MS C++ runtime libraries. For example, you may have a version of QT built against msvcp110.dll (visual studio 2012) but your current project uses msvcp120.dll (visual studio 2013).

以上转自http://stackoverflow.com/questions/26803975/debug-assertion-failed-pfirstblock-phead-using-opencv

原文地址:https://www.cnblogs.com/qrlozte/p/6649450.html