i'm new to OpenCV, and i got a problem with linkage.
I'm using Ubuntu 11.10, OpenCV 2.3.1 was installed according to this guide:
I'm building many small applications with it, and it looks fine.
Usually, i'm building with pkg-config --libs --cflags opencv
.
Now, i'm trying to build some framework that someone else wrote, it compiles without any problems, but i can't link it: there is a long list of "unresolved reference to..." (thousands of them). all symbols related to opencv_core are not found.
I tried to recompile OpenCV without precompiled header support, didn't help. of course. :(
the test_opencv_core application is running fine, but opencv_rand failed. I think it says that opencv_core is correct, in general, but it still doesn't work when I need it...
Can you please try to give me some hint? I'm lost there.
Thank you in advance, David
Update: Solved.
gcc 4.6.1 require that the libs and sources will apear in the command line before pathes to shared libs. why? don't know. just spent 24 hours for this stupid mistake :(
Update: Understandable. from the ld man page:
The linker will search an archive only once, at the location where it is specified on the command line. If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again.
See the -( option for a way to force the linker to search archives multiple times.
That's it.
You can find OpenCV2 (i.e. C++ version) libraries (e.g. libopencv_core.so,libopencv_highgui.so etc) at /usr/local/lib . If you want libraries for c version only (e.g. libcv. a,libcxcore. a etc) you can find them at /usr/lib .
You uninstall using the same tool you used to install. Simply use 'remove' instead of 'install'. Apt does the cleanup -- proper cleanup is a fundamental job of a package manager. You don't need to update your database of available packages in the repository, since you are removing packages instead of installing.
gcc 4.6.1 require that the libs and sources will appear in the command line before paths to shared libs. I don't know why.
Update: Understandable. from the ld man page:
The linker will search an archive only once, at the location where it is specified on the command line. If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again.
See the -( option for a way to force the linker to search archives multiple times.
That's it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With