Search code examples
c++opencvlinkerg++eclipse-cdt

How to resolve this linker error?


I am trying to use a compiled library inside an Eclipse project. The compilation goes fine but during linking i get an error. Below is the verbose generated on eclipse console.

g++ -L/usr/local/lib -o "readInput" ./readInput.o -llibopencv_calib3d.so -llibopencv_contrib.so -llibopencv_core.so

/usr/bin/ld: cannot find -llibopencv_calib3d.so  
/usr/bin/ld: cannot find -llibopencv_contrib.so  
/usr/bin/ld: cannot find -llibopencv_core.so

I dont know even after providing the library paths why is the linker giving error that it could not find it.


Solution

  • Assuming you have all required libraries: for libSOMETHING.so, specify -lSOMETHING instead of -llibSOMETHING.so. Omit the initial lib and final .so.