1. 程式人生 > >findContours出錯 Debug Assertion Failed!Expression:_pFirstBlock == pHead vs2013

findContours出錯 Debug Assertion Failed!Expression:_pFirstBlock == pHead vs2013

出錯在這一句語句:

findContours(openimage, temptours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);


網路上找原因,很多,一遍遍檢查,最後按照這個 

Under Property > C++ > code generation > Runtime libarary:
If the MSVC Runtime library is set to Multi-threaded Debug DLL (/MDd), then this is no problem (it works fine).

If the MSVC Runtime library is set to Multi-threaded Debug (/MTd), then it will throw this error, which can be fixed with the following instructions.


因為是在mfc下,又出現這個錯誤:

 #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. P

如下解決:

將類封裝成DLL時,因為類中使用了CDC類,所以需要# include “stdafx.h”.

編譯時出現錯誤:Building MFC application with /MD[d] (CRT dll version)requires MFC shared dll version
該錯誤解決方法如下: 對著你的專案點選右鍵,依次選擇:屬性->配置屬性->常規,然後右邊有個“專案預設值”(Project Defaults),下面有個"MFC的使用"(Use of MFC),選擇“在共享 DLL 中使用 MFC”(Use MFC in a Shared DLL),就OK了~~~