Reputation: 1509
I have a Dell XPS M1530 running windows 7. I installed virtual box and created an ubuntu 12.04 installation. I then installed openCV as described here. Which seems very similar to the directions here, but when I try to run g++ on the test program image-conversion.c as described in the second link, I get the following output:
jonathan@jonathan-VirtualBox:~/test$ g++ `pkg-config opencv --cflags --libs` image-conversion.c -o image-conversion
/tmp/ccoPBxUv.o: In function `main':
image-conversion.c:(.text+0x1d): undefined reference to `cvLoadImage'
image-conversion.c:(.text+0x41): undefined reference to `cvSaveImage'
image-conversion.c:(.text+0x4d): undefined reference to `cvReleaseImage'
collect2: ld returned 1 exit status
However, when I use the test program provided by the first link, everything works perfectly. So my question is, what am I not understanding about the installation process or perhaps in the compilation process that is making the examples not work in the second link.
Upvotes: 0
Views: 922
Reputation: 673
The errors appear to be linking errors, my guess is g++ isn't finding the library. You might try adding the path to libopencv.so to LD_LIBRARY_PATH. Also make sure the version of opencv matches the example. Those three functions are the older c style interface. Also you could run "pkg-config opencv --cflags --libs" in the command line. This will expand it and tell you where it is looking for these things, then you can grep around and see if things match. Sometimes you need #include opencv2/highgui.hpp or some such thing. Also "g++ -v" helps sometimes. Sorry I couldn't just give you a straight answer, Good Luck.
Upvotes: 1