opencv+qt编译release版本报错,提示cv::cvtColor、cv::bilateralFilter等符号找不到

前些天的qt程序一直用debug版本调试,今天换到release后,发现编译不通过了,提示的各种符号找不到,可是就算用的opencv的debug版本的库,release版本程序也应该能找到二进制里面的符号才对,难道是头文件里面对对debug版本做了特殊处理,于是从opencv的头文件中搜索_DEBUG关键字,搜到的第一个文件就是opencv2\core\cvdef.h,而里面正好有namespace cv的相关定义

opencv2\core\cvdef.h

//#if !defined CV_DOXYGEN && !defined CV_IGNORE_DEBUG_BUILD_GUARD
//#if (defined(_MSC_VER) && (defined(DEBUG) || defined(_DEBUG))) || \
//    (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_DEBUG_PEDANTIC))
//// Guard to prevent using of binary incompatible binaries / runtimes
//// https://github.com/opencv/opencv/pull/9161
#define CV__DEBUG_NS_BEGIN namespace debug_build_guard {
#define CV__DEBUG_NS_END }
namespace cv { namespace debug_build_guard { } using namespace debug_build_guard; }
//#endif
//#endif

把上面两个if的宏判断注释掉,两个endif注释掉,再编译,就好了,也就不用找其他文件了。可能release版本程序最好还是用release版本的opencv库吧

发布了275 篇原创文章 · 获赞 46 · 访问量 28万+

猜你喜欢

转载自blog.csdn.net/youyudexiaowangzi/article/details/104200821
今日推荐