Opencv libraries cannot get linked with Eclipse on Windows 11

Viewed 31

I try to run the following code in Eclipse

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv )
{
    if( argc != 2)
    {
     cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
     return -1;
    }

    Mat image;
    image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file

    if(! image.data )                              // Check for invalid input
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }

    namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display.
    imshow( "Display window", image );                   // Show our image inside it.

    waitKey(0);                                          // Wait for a keystroke in the window
    return 0;
}

Got the error

15:17:43 **** Incremental Build of configuration Debug for project Image ****
Info: Internal Builder is used for build
g++ "-IC:\\opencv_src\\Mingw_build\\install\\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\Image.o" "..\\src\\Image.cpp" 
..\src\Image.cpp: In function 'int main(int, char**)':
..\src\Image.cpp:25:29: error: 'CV_LOAD_IMAGE_COLOR' was not declared in this scope
     image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file
                             ^~~~~~~~~~~~~~~~~~~
..\src\Image.cpp:25:29: note: suggested alternative: 'CV_HAL_DFT_STAGE_COLS'
     image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file
                             ^~~~~~~~~~~~~~~~~~~
                             CV_HAL_DFT_STAGE_COLS

15:17:44 Build Failed. 1 errors, 0 warnings. (took 825ms)

The project setting information are following

enter image description here

enter image description here

Available libraries

enter image description here

I am not sure why symbol cv cannot resolved?

Thank you.

0 Answers
Related