[ubuntu-in] openCV on Ubuntu 12.10

Alok Singh Mahor alokmahor at gmail.com
Thu Dec 27 06:02:02 UTC 2012


Hi all,
few days ago I installed openCV from source by following
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
and everything was working fine for me.

yesterday I removed openCV and reinstalled from Ubuntu repository
I installed libopencv-dev, which automatically installed all required
libraries

output of pkg-config --cflags --libs opencv is
-I/usr/include/opencv  -lopencv_core -lopencv_imgproc -lopencv_highgui
-lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d
-lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

which means I have all the required libraries which i got from installation
from source.
but simple code given in
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installationis
not compiling now which were working fine with installation from
source.

I am getting linker errors
alok at alok:~/exp/opencv/exp$ g++ `pkg-config --cflags opencv` `pkg-config
--libs opencv`  alok.cpp
/tmp/cc7u9KXa.o: In function `main':
alok.cpp:(.text+0x67): undefined reference to `cv::imread(std::string
const&, int)'
alok.cpp:(.text+0xfa): undefined reference to `cv::namedWindow(std::string
const&, int)'
alok.cpp:(.text+0x122): undefined reference to
`cv::_InputArray::_InputArray(
cv::Mat const&)'
alok.cpp:(.text+0x159): undefined reference to `cv::imshow(std::string
const&, cv::_InputArray const&)'
alok.cpp:(.text+0x17b): undefined reference to `cv::waitKey(int)'
/tmp/cc7u9KXa.o: In function `cv::Mat::~Mat()':
alok.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x2b): undefined reference
to `cv::fastFree(void*)'
/tmp/cc7u9KXa.o: In function `cv::Mat::operator=(cv::Mat const&)':
alok.cpp:(.text._ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0xf2): undefined
reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/cc7u9KXa.o: In function `cv::Mat::release()':
alok.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x3b): undefined
reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status

could someone tell me why I am getting this error?
is there some difference in installing from official source and Ubuntu
repository?
thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-in/attachments/20121227/a710e26d/attachment.html>


More information about the ubuntu-in mailing list