Error (undefined reference to 'main') in the eclipse CDT setup tutorial

asked 2017-01-14 14:44:03 -0600

jrbent gravatar image

Hi! I am trying to work through the "Using OpenCV with Eclipse (plugin CDT)" tutorial on this site I keep getting an error when I build the the project as is stated in the tutorial. The output is:

 **** Build of configuration Debug for project DisplayImage ****

make all 
Building file: ../src/DisplayImage.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DisplayImage.d" -MT"src/DisplayImage.d" -o"src/DisplayImage.o" "../src/DisplayImage.cpp"
Finished building: ../src/DisplayImage.cpp

Building target: DisplayImage
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o"DisplayImage"  ./src/DisplayImage.o   -lopencv_core -lopencv_imgproc -lopencv_highgui
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
makefile:45: recipe for target 'DisplayImage' failed
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [DisplayImage] Error 1

The DisplayImage.cpp code is pasted directly from the tutorial, and the makefile, I suppose, was automatically generated in Eclipse. If anyone can help me with this, I would be very grateful! Thanks!

edit retag flag offensive close merge delete