0

not sure how to proceed... still wet behind the ears, looking for advice.

21:30:40 **** Incremental Build of configuration Release for project DisplayImage ****
make all 
Building file: ../src/dispalyimage.cpp
Invoking: GCC C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/dispalyimage.d" -MT"src/dispalyimage.d" -o "src/dispalyimage.o" "../src/dispalyimage.cpp"
Finished building: ../src/dispalyimage.cpp

Building target: DisplayImage
Invoking: GCC C++ Linker
g++  -o "DisplayImage"  ./src/dispalyimage.o   
./src/dispalyimage.o: In function `cv::Mat::~Mat()':
dispalyimage.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x69): undefined reference to `cv::Mat::deallocate()'
dispalyimage.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x54): undefined reference to `cv::fastFree(void*)'
./src/dispalyimage.o: In function `main':
dispalyimage.cpp:(.text.startup+0x94): undefined reference to `cv::imread(std::string const&, int)'
dispalyimage.cpp:(.text.startup+0x125): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
dispalyimage.cpp:(.text.startup+0x20d): undefined reference to `cv::namedWindow(std::string const&, int)'
dispalyimage.cpp:(.text.startup+0x235): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
dispalyimage.cpp:(.text.startup+0x259): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
dispalyimage.cpp:(.text.startup+0x273): undefined reference to `cv::waitKey(int)'
dispalyimage.cpp:(.text.startup+0x284): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
make: *** [DisplayImage] Error 1

21:30:42 Build Finished (took 1s.367ms)

build exits without making executable here's the cpp /* * dispalyimage.cpp * * Created on: Aug 18, 2014 * Author: owner */

#include <opencv/cv.h>
#include <opencv/highgui.h>

using namespace cv;

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

if( argc != 2 || !image.data )
{
  printf( "No image data \n" );
  return -1;
}

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

waitKey(0);

return 0;
}
Morgan
  • 1
  • 2
  • You need to tell it to link the OpenCV library. Right now you're not providing it with any of those definitions it can't find. – Crowman Aug 19 '14 at 02:12
  • Thanks, I appreciate the help. I have been fighting with that process, I will try again. – Morgan Aug 19 '14 at 02:24
  • [This answer](http://stackoverflow.com/questions/7816607/opencv-2-3-compiling-issue-undefined-refence-ubuntu-11-10?rq=1) may help. – Crowman Aug 19 '14 at 02:28
  • that was definitely part of the issue, however I am still not producing a ".o" file 22:32:00 **** Incremental Build of configuration Release for project DisplayImage **** make all make: Nothing to be done for `all'. 22:32:00 Build Finished (took 65ms) – Morgan Aug 19 '14 at 02:34
  • "g++ -o test_1 test_1.cpp `pkg-config opencv --cflags --libs" from terminal builds and creates my ".o" but how do I do this from eclipse – Morgan Aug 19 '14 at 02:40
  • 1
    If you're getting to the linker step, you've already made your `.o` file. It's the executable file `DisplayImage` that you're having trouble with. I'm not familiar with Eclipse, it might be easier to just build it from the command line if you're just starting out. – Crowman Aug 19 '14 at 02:41

0 Answers0