'Compiler is skipping incompatible library when using OpenCV in QT

I'm trying to use OpenCV in QT, it seems that the library is not linked. I've checked the version of opencv_core455d.lib, it is a 32 bit library, and my QT application is in 64 bit mode. Is it the problem and should I compile OpenCV in 64 bit mode?

.pro file(part):

LIBS += -L"D:\\env\\opencv\\build\\lib\\Debug" -lopencv_core455d
INCLUDEPATH += D:\\env\\opencv\\build\\include

main.cpp(full):


#include <QApplication>
#include <opencv2/core.hpp>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    cv::Mat mat;
    MainWindow w;
    w.show();
    return a.exec();
}

compiler output:

:-1: error: skipping incompatible D:\env\opencv\build\lib\Debug/opencv_core455d.lib when searching for -lopencv_core455d
:-1: error: skipping incompatible D:\env\opencv\build\lib\Debug/opencv_core455d.lib when searching for -lopencv_core455d
:-1: error: skipping incompatible D:\env\opencv\build\lib\Debug\opencv_core455d.lib when searching for -lopencv_core455d
:-1: error: cannot find -lopencv_core455d
:-1: error: skipping incompatible D:\env\opencv\build\lib\Debug/opencv_core455d.lib when searching for -lopencv_core455d
:-1: error: collect2.exe: error: ld returned 1 exit status
:-1: error: [Makefile.Debug:72: debug/testopencv5.exe] Error 1


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source