Link to OpenCV 2.3.1 on Ubuntu

I am new to OpenCV, and I am having a binding problem.

I am using Ubuntu 11.10, OpenCV 2.3.1 has been installed according to this guide:

I create a lot of small applications with it, and it looks great. I usually create pkg-config --libs --cflags opencv .

Now I'm trying to create a framework that someone wrote, it compiles without any problems, but I can’t link it: there is a long list of "unresolved links to ..." (thousands of them). all characters associated with opencv_core were not found.

I tried recompiling OpenCV without first compiling the header, it didn't help. of course.: (

test_opencv_core application is working fine, but opencv_rand failed. I think this suggests that opencv_core is correct in general, but it still doesn't work when I need it ...

Could you try to give me some hint? I got lost there.

Thanks in advance, David

Update: Solvable.

gcc 4.6.1 requires that libs and sources appear on the command line before accessing shared libs. What for? I do not know. just spent 24 hours for this stupid mistake :(

Update: Clear. from the ld man page:

Linkers will search the archive only once, in the place where it is specified on the command line. If the archive defines a character that was undefined in some object that appeared before the archive on the command line, the linker will contain the corresponding file from the archive. However, the undefined character in an object that appears later on the command line will not call the linker to search the archive again.

See section - (option to force the linker to search for archives several times.

What is it.

+6
source share
1 answer

gcc 4.6.1 requires libraries and sources to appear on the command line before shared libs paths. I do not know why.

Update: Clear. from the ld man page:

Linkers will search the archive only once, in the place where it is specified on the command line. If the archive defines a character that was undefined in some object that appeared before the archive on the command line, the linker will contain the corresponding file from the archive. However, the undefined character in an object that appears later on the command line will not call the linker to search the archive again.

See section - (option to force the linker to search for archives several times.

What is it.

+1
source

Source: https://habr.com/ru/post/907748/


All Articles