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 6796035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:25:06+00:00 2026-05-26T18:25:06+00:00

I am trying to write a C++ application using the OpenCV libraries. As per

  • 0

I am trying to write a C++ application using the OpenCV libraries. As per the recommendation from the OpenCV maintainers, I am using CMake to generate the Makefile. My platform is Windows 7 (64 bit). My compiler is MinGW (so I am using the ‘mingw32-make’ tool to build the application).

Right now I am trying to make sure my setup is correct so I can move forward with the code. I have verified that the OpenCV libraries have been built correctly. I then tried to verify that I could use CMake to include the OpenCV libraries in my build. I am using the following sample code from an OpenCV tutorial:

DisplayImage.cpp

#include <cv.h>
#include <highgui.h>

using namespace cv;

int main( int argc, char** argv )
{
    Mat image;
    image = imread( argv[1], 1 );

    if (argc != 2 || !image.data)
    {
        printf( "No image data \n" );
        return -1;
    }

    namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
    imshow( "Display Image", image );

    waitKey(0);

    return 0;
}

CMakeLists.txt

cmake_minimum_required( VERSION 2.8 )

project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

I used cmake-gui to generate the Makefile, then used mingw32-make to build the application. Everything works fine and the program compiles with no errors. However, when I try to run it, Windows stops and complains that it needs libopencv_core231.dll. I have checked and this dll is in my (OpenCV Build location)/bin directory. How can I get CMake/MinGW to include this when compiling?

  • 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-05-26T18:25:07+00:00Added an answer on May 26, 2026 at 6:25 pm

    copy opencv dlls into your executable folder.

    MACRO (COPY_DLL trgt libname)
            ADD_CUSTOM_COMMAND (
            TARGET ${trgt}
            POST_BUILD
            COMMAND ${CMAKE_COMMAND}
            ARGS -E copy "${OPENCVDIR/bin}/${libname}.dll" ${CMAKE_CURRENT_BINARY_DIR}
        )
    ENDMACRO (COPY_DLL)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a small application using bouncycastle algorithm, from the BouncyCastleProvider.java
I'm trying to write a web application using SpringMVC. Normally I'd just map some
I'm trying to write an application that converts 48 bit-per-pixel PNG files to a
I trying to write an application that has a collection of students using different
I've been trying to write an application, using Qt and mingw32, to download images
I'm trying to write a client-server console application on C# using UDP. And i
I am using Microsoft Visual Studio 2010 and the OpenCV 2.3.0 libraries to write
I'm trying to write an application using QNetworkManager. I have simplified the code down
I'm trying to write an application server using Happstack, Heist, and web-routes, but am
I'm trying to write a web application using the new offline capabilities of HTML5.

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.