On Fri, Feb 7, 2020 at 4:07 AM George N. White III <gnwiii@gmail.com> wrote:
On Thu, 6 Feb 2020 at 15:04, Danishka Navin <danishka@gmail.com> wrote:
Hi,

I am new to eclipse and opencv and I was trying to build a sample c++ code using Eclipse.

I have installed following packages.
rpm -qa | grep opencv
opencv-devel-3.4.4-10.fc30.x86_64
opencv-3.4.4-10.fc30.x86_64
opencv-core-3.4.4-10.fc30.x86_64
opencv-contrib-3.4.4-10.fc30.x86_64


00:29:09 **** Incremental Build of configuration Debug for project sample ****
make all
Building target: sample
Invoking: GCC C++ Linker
g++ -L/usr/lib64/ -L/usr/lib/ -o "sample"  ./main.o   -llibopencv_core.so.3.4 -llibopencv_core.so.3.4.4 -llibopencv_highgui.so.3.4 -llibopencv_highgui.so.3.4.4

libopencv_core.so.3.4 should be a symbolic link to libopencv_core.so.3.4.4, same for libopencv_highgui.so.3.4.

that's right

$ ls -l /usr/lib64/libopencv_core.so*
lrwxrwxrwx 1 root root      21 May 21  2019 /usr/lib64/libopencv_core.so -> libopencv_core.so.3.4
lrwxrwxrwx 1 root root      23 May 21  2019 /usr/lib64/libopencv_core.so.3.4 -> libopencv_core.so.3.4.4
-rwxr-xr-x 1 root root 4898472 May 21  2019 /usr/lib64/libopencv_core.so.3.4.4

$ ls -l /usr/lib64/libopencv_highgui.so*
lrwxrwxrwx 1 root root     24 May 21  2019 /usr/lib64/libopencv_highgui.so -> libopencv_highgui.so.3.4
lrwxrwxrwx 1 root root     26 May 21  2019 /usr/lib64/libopencv_highgui.so.3.4 -> libopencv_highgui.so.3.4.4
-rwxr-xr-x 1 root root 425512 May 21  2019 /usr/lib64/libopencv_highgui.so.3.4.4
 
Try:

g++ -o "sample"  ./main.o -lopencv_core -lopencv_highgui 


no errors

[danishka@2000 Debug]$ pwd
/home/danishka/workspace/sample/Debug
[danishka@2000 Debug]$ ls
main.d  main.o  makefile  objects.mk  sources.mk  subdir.mk
[danishka@2000 Debug]$ g++ -o "sample"  ./main.o -lopencv_core -lopencv_highgui
[danishka@2000 Debug]$ ls
main.d  main.o  makefile  objects.mk  sample  sources.mk  subdir.mk
[danishka@2000 Debug]$ ls -l
total 124
-rw-rw-r-- 1 danishka danishka    20 Feb  7 00:26 main.d
-rw-rw-r-- 1 danishka danishka 54040 Feb  7 00:26 main.o
-rw-rw-r-- 1 danishka danishka  1318 Feb  7 00:29 makefile
-rw-rw-r-- 1 danishka danishka   337 Feb  7 00:29 objects.mk
-rwxrwxr-x 1 danishka danishka 48224 Feb  7 09:19 sample
-rw-rw-r-- 1 danishka danishka   526 Feb  7 00:29 sources.mk
-rw-rw-r-- 1 danishka danishka   708 Feb  7 00:29 subdir.mk


Stackoverflow has this among other solutions.
 
/usr/bin/ld: cannot find -llibopencv_core.so.3.4
/usr/bin/ld: cannot find -llibopencv_core.so.3.4.4
/usr/bin/ld: cannot find -llibopencv_highgui.so.3.4
/usr/bin/ld: cannot find -llibopencv_highgui.so.3.4.4
collect2: error: ld returned 1 exit status
make: *** [makefile:46: sample] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

00:29:10 Build Failed. 5 errors, 0 warnings. (took 419ms)


$ locate opencv_core.so.3.4
/usr/lib64/libopencv_core.so.3.4
/usr/lib64/libopencv_core.so.3.4.4

I have already added /usr/lib64/ and /usr/lib/ as library search paths in eclipse.

Is there anything missing in my config?

Regards,
--
Danishka Navin


--
George N. White III

_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org


--
Danishka Navin