The problem written below the line is solved but i m facing a new related problem.
Slightly different from before, I am compiling and linking the sample OpenCV code as:
g++ facedetect.cpp -o facedetection -I /home/harsh/Downloads/OpenCV-2.0.0/include/opencv/ -L/home/harsh/Downloads/OpenCV-2.0.0/lib/ -lcv -lcxcore -lcvaux -lml -lhighgui
That doesn’t give any errors now, but when I run the executable using
./facedetection
i get this error:
./facedetection: error while loading shared libraries: libcv.so.2.0: cannot open shared object file: No such file or directory
And when I do symbolic linking, using:
ln -s libcv.so libcv.so.2.0
Then the error is:
ln: failed to create symbolic link 'libcv.so.2.0': File exists
Don’t know how to get around this.
Thanks in advance..
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
I am trying to create a linux executable of a sample OpenCV program that will be linked dynamically with .so files and will be executed on a machine where OpenCV is not installed, but the .so files will be present on that linux machine.
I have searched many posts regarding this but still am unsuccessful.
I compiled opencv like this:
cd OpenCV-2.0.0/
cmake -DBUILD_SHARED_LIBS=ON .
make
Then all the compiled libraries were created in OpenCV-2.0.0/lib
Then, in the samples/c directory, I did this:
g++ facedetect.cpp -o facedetection -I /home/harsh/Downloads/OpenCV-2.0.0/include/opencv/ -L/home/harsh/Downloads/OpenCV-2.0.0/lib/ -llibcv -llibcxcore -llibcvaux -llibml -llibhighgui
But Errors are :
/usr/bin/ld: cannot find -llibcv
/usr/bin/ld: cannot find -llibcxcore
/usr/bin/ld: cannot find -llibcvaux
/usr/bin/ld: cannot find -llibml
/usr/bin/ld: cannot find -llibhighgui
collect2: ld returned 1 exit status
Use
-lcv,-lcxcore, etc.To link to
libfoo.so, the flag is-lfoo, without thelibpart.If your libraries aren’t in the default runtime library search path (how this is set/managed depends on your OS and distribution), you need to inform the dynamic linker as to where they are located. (Just like you have to do so when you compile by adding
-Lflags.)On Linux, this is done by setting the environment variable
LD_LIBRARY_PATH, e.g.: