Ask Your Question

Problem Building a Project in Eclipse [Ubuntu]

asked 2012-08-01 18:04:13 -0500

NickOS gravatar image


I followed exactly the tutorial in

and when I tried to build the project I created, I got 2 errors in the console:

Building target: Test
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o"Test" ./src/Test.o -lopencv_core -lopencv_highgui -lopencv_legacy -lopencv_ml -lopencv_video -lopencv_contrib -lopencv_features2d -lopencv_imgproc -lopencv_calib3d -lopencv_objdetect -lopencv_flann
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':

(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [Test] Error 1

What seems to be the problem?

Thanks, in advance.

edit retag flag offensive close merge delete


Dear NickOS,

Did you solve the problem cause i have the same problem and cannot find a solution. I have tried numerous methods and I followed the opencv tutorial exactly as you did.

Any help will be much appreciated since i am stuck and I cannot proceed.

Best Regards, Robert Grech

Robert_Grech gravatar imageRobert_Grech ( 2013-10-30 07:33:46 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2012-08-02 10:03:05 -0500

jasedit gravatar image

What are the contents of Test.cpp? It is reporting it can't find the definition of the main() function - without seeing the contents of Test.cpp as you have it saved on disk, it's hard to tell for certain what's going wrong.

The signature of main() could be wrong, or an errant semicolon could be making the definition not be found. Or main() could be in another file altogether that isn't being linked into Test. Without seeing Test.cpp I can't be certain what's going wrong.

edit flag offensive delete link more


Thank you for your interest, and sorry if I wasn't clear. The Test.cpp has the code snippet from the tutorial I mentioned before:

#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 || ! )
      printf( "No image data \n" );
      return -1;

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


  return 0;
NickOS gravatar imageNickOS ( 2012-08-02 19:26:19 -0500 )edit

answered 2014-06-23 07:29:48 -0500

shruti gravatar image

Dear NickOS, you have not included this header file

include <iostream>

your problem will be solved and if not please again check if you have included and given correct path to libraries.

Thank you

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2012-08-01 18:04:13 -0500

Seen: 1,263 times

Last updated: Jun 23 '14