Ask Your Question
0

Eclipse give an errors when I try to compile Opencv program

asked 2014-01-03 02:00:34 -0600

OoVoO gravatar image

./src/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.o:(.data+0x0): multiple definition of info_compiler' ./src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.o:(.data+0x0): first defined here ./src/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.o:(.data+0x4): multiple definition ofinfo_platform' ./src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.o:(.data+0x4): first defined here ./src/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.o:(.data+0x8): multiple definition of info_arch' ./src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.o:(.data+0x8): first defined here ./src/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.o: In functionmain': /eclipse/opencv/Debug/../src/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.c:382: multiple definition of main' ./src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.o: /eclipse/opencv/Debug/../src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:366: first defined here ./src/dialogwindow.o: In functioncv::MatSize::MatSize(int)': /eclipse/opencv/Debug/../src/dialogwindow.cpp:18: multiple definition of `main' ./src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.o:/eclipse/opencv/Debug/../src/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:366: first defined here collect2: error: ld returned 1 exit status make: ** [opencv] Error 1

include "opencv2/highgui/highgui_c.h"

include<opencv2 highgui="" highgui.hpp="">

include <iostream>

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

if( argc != 2 || !image.data ) { cout << "No image data \n" <<endl; return="" -1;="" }<="" p="">

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

waitKey(0);

return 0; }

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-01-03 06:03:23 -0600

updated 2014-01-03 06:07:35 -0600

Use c++ interface and

#include <iostream>
#include "opencv2/opencv.hpp"

using namespace cv; 
using namespace std; 

int main( int argc, char** argv ){
    Mat image; 
    image = imread( argv[1] );
    if( argc != 2 || !image.data ) 
    { 
        cout << "No image data \n" <<endl; 
        return=-1;
    }

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

    waitKey(0);
    return 0; 
}
edit flag offensive delete link more

Comments

I still have a error with this line exactly with CV_WINDOW_AUTOSIZE ../src/dialogwindow.cpp:17:35: error: ‘CV_WINDOW_NORMAL’ was not declared in this scope make: * [src/dialogwindow.o] Error 1

I compiled with CMakeLists.txt and it works perfectly, but I want to fix that problem in eclipse.

OoVoO gravatar imageOoVoO ( 2014-01-03 10:12:37 -0600 )edit

Question Tools

Stats

Asked: 2014-01-03 02:00:34 -0600

Seen: 838 times

Last updated: Jan 03 '14