开发者

FFMPEg and gcc problem

开发者 https://www.devze.com 2023-03-14 05:01 出处:网络
The problem is this: I wrote a simple program that uses FFMPEG. compile as follows: gcc -lavcodec -lavformat -lavutil -c test.c

The problem is this: I wrote a simple program that uses FFMPEG. compile as follows:


gcc -lavcodec -lavformat -lavutil -c test.c

gcc -lavcodec -lavformat -Lavut -o test test.o

Compiled开发者_Python百科 without problems, test file appears, but when you start: . / test An error occurs:

. / test: error while loading shared libraries: libavcodec.so.53: cannot open shared object file: No such file or directory

At what ffmpeg was originally built and installed and the file libavcodec.so.53 there. In what may be the problem?


You appear to be linking against libraries in a custom library directory, -Lavut.

Check where your loader looks for the executable's libraries:

ldd ./test

If any of them are in non-standard directories (and ldd indicates that a particular library couldn't be found), append those to the LD_LIBRARY_PATH:

LD_LIBRARY_PATH=/tmp/work/avut ./test

If you like, you can hardcode the library path into the executable with the -rpath linker option, e.g. gcc ... -Wl,-rpath -Wl,/tmp/work/avut.

0

精彩评论

暂无评论...
验证码 换一张
取 消