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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:10:40+00:00 2026-06-07T05:10:40+00:00

I have just installed OpenCV and have been trying to execute an example to

  • 0

I have just installed OpenCV and have been trying to execute an example to DsiplayImage.
I get the following error while trying to “cmake .”

~/Desktop$ cmake . CMake Error at CMakeLists.txt:5
(target_link_libraries): Cannot specify link libraries for target
“DisplayImage” which is not built by this project.

— Configuring incomplete, errors occurred!

The following is the actual code:
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} )
  • 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-07T05:10:41+00:00Added an answer on June 7, 2026 at 5:10 am

    it should be

    cmake_minimum_required(VERSION 2.8)
    PROJECT( displayimage )
    FIND_PACKAGE( OpenCV REQUIRED )
    ADD_EXECUTABLE( displayimage displayimage.cpp )
    TARGET_LINK_LIBRARIES( displayimage ${OpenCV_LIBS} )
    

    I tried this code on my machine and it works. maybe its because all commands have to be capital letters!!no idea but it works
    cheers 🙂

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

Sidebar

Related Questions

I have just installed the OpenCV 2.2 library with VS 2010 following the willowgarage
I have just installed CentOS, Apache and PHP. When I visit my site http://example.com/myapp/
I have been trying to set up OpenCV for the past few days with
I've been trying on and off for the past 6 months to get OpenCV
I have just installed OpenCV on my Windows 7 machine. As a result, I
I am not a Unix guy, so I have been trying to install openCV
I have been trying to do build and use OpenCV 2.3.0 on my Fedora15
Have just installed docblox on windows using PEAR. Am running into the error 'can
I have just installed composer in my /usr/bin folder, so when from that folder
I have just installed Java JDK 6u33 in Windows XP. Even though I didn't

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.