Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:05:24+00:00 2026-06-10T08:05:24+00:00

I tried two methods to use opencv with qt creator first one using Mingw

  • 0

I tried two methods to use opencv with qt creator
first one using Mingw where the dlls and .dll.a files are already downloaded with the opencv library and I just add reference to the .dll.a files in the .pro file as follow

INCLUDEPATH += D:\\OpenCV\\opencv\\build\\include
LIBS += D:\\OpenCV\\opencv\\build\\x64\\mingw\\lib\\libopencv_calib3d242.dll.a
LIBS += D:\\OpenCV\\opencv\\build\\x64\\mingw\\lib\\libopencv_contrib242.dll.a
LIBS += D:\\OpenCV\\opencv\\build\\x64\\mingw\\lib\\libopencv_core242.dll.a
LIBS += D:\\OpenCV\\opencv\\build\\x64\\mingw\\lib\\libopencv_features2d242.dll.a

I have a simple code to test opencv:

#include <QtCore/QCoreApplication>
#include <opencv/cv.h>

using namespace cv;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    Mat image;

    return a.exec();
}

but I got a build issues as follow

C:\Users\Kato\Documents\QT projects\QtOpenCVYaRab\debug\main.o:-1: In function ~Mat':
d:\OpenCV\opencv\build\include\opencv2\core\mat.hpp:278: error: undefined reference to
cv::fastFree(void*)’
d:\OpenCV\opencv\build\include\opencv2\core\mat.hpp:367: error: undefined reference to `cv::Mat::deallocate()’
:-1: error: collect2: ld returned 1 exit status

Here is some of the compile output:

Running build steps for project QtOpenCVYaRab...
Configuration unchanged, skipping qmake step.
Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" 
C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/Kato/Documents/QT projects/QtOpenCVYaRab'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL

 d:/OpenCV/opencv/build/include/opencv2/core/mat.hpp:278: undefined reference to `cv::fastFree(void*)'
debug/main.o:d:/OpenCV/opencv/build/include/opencv2/core/mat.hpp:367: undefined reference to `cv::Mat::deallocate()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\QtOpenCVYaRab.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project QtOpenCVYaRab (target: Desktop)
When executing build step 'Make'

the second method is using cmake to compile the opencv library the using visual studio 2010 to build it and add references to the files in the bin folder but I got almost the same building issues.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:05:25+00:00Added an answer on June 10, 2026 at 8:05 am
    #include "iostream"
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    
    using namespace cv;
    using namespace std;
    
    int main()
    {
        IplImage *image = cvLoadImage("C:\\lena.jpg");
        Mat im(image);
        imshow("TEST",im);
        waitKey();
        return 0;
    }
    

    this is ur main.cpp…the above programme displays the picture of lena…use double backslashes for indicating change of directory on windows platform…some how the imread does work for me so i have loaded the image as IplImage and casted it to Mat…u cn do the following also..

     IplImage *image = cvLoadImage("C:\\lena.jpg",1);
     cvShowImage("TEST",image);
     cvWaitKey();
    

    your .pro file should have the following lines as mentioned earlier…

    INCLUDEPATH += D:\OpenCV\opencv\build\include
    
    LIBS +=-LD:\OpenCV\opencv\build\x64\mingw\lib\
    -lopencv_core242\
    -lopencv_highgui242\
    -lopencv_imgproc242\
    -lopencv_video242\
    

    and your system variable named path should have

    1. D:\Opencv2.4.2\opencv\build\x86\vc9\bin (if you have Qt 4.8.1 for
      desktop MSVC2008 (QtSDK) Debug as your target)
    2. D:\Opencv2.4.2\opencv\build\x86\mingw\bin (if your target is based on Qt MinGW x86 )
    3. D:\OpenCV2.4.2\opencv\build\common\tbb\ia32\vc9(mingw) (i have added this coz it was showing some weird errors…u can try it)

    after editing the path variable close the Qt ide/application and restart it for the system variable change to get reflected..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in one of my projects I'm using following two methods. 1. GetDoubleValue and 2.
I have tried two different methods. The first is to specify the link in
I tried to configure google adsense on my drupal site. I used two methods.
I'm currently using the following two methods in my class to get the job
I have a class TableData with two magic methods. One is the constructor and
Best way to group overlapping rectangles? I've tried using OpenCV but the grouprectangles method
I made a small DLL in MSIL with two methods: float AddNumbers(int, int) int
I've tried two ways to constrain a generic type parameter to a nullable type,
I've tried this two ways. Way 1 function Login() { var email = encodeURIComponent($(#loginemail).val());
I tried to split two fields from a binary string: -define(S,<<M\0\0\0522039355099,010100000008,0,010170000000,0,0,0,0,0,0,,,0,0,,‌​0110,00,150,0,0,0\0>>).<<Message_length:4/binary,Msg/binary>> = S. the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.