Ask Your Question
0

Eclipse give an errors when I try to compile Opencv program

asked Jan 3 '14

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; }

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Jan 3 '14

updated Jan 3 '14

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; 
}
Preview: (hide)

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 (Jan 3 '14)edit

Question Tools

Stats

Asked: Jan 3 '14

Seen: 876 times

Last updated: Jan 03 '14