Compile
The problem encountered in the compilation stage is often that the header file cannot be found
ffplay.c:57:17: fatal error: SDL.h: No such file or directory
In this case, check the include path, you can use -I to add the header file search path. You can refer to the loading sequence of linux header files
link
After the compilation is successful, the problems encountered in the linking phase are often undefined reference to...
cmdutils.c:(.text+0x6f55): undefined reference to `av_log_set_level'
In this case, you should check the link library. You can use -L to specify the search location of the link library, or add the environment variable LIBRARY_PATH. The sequence of finding the so library during linking is as follows:
-
The path specified by the parameter -L when gcc is compiled
gcc -o demux demuxing_decoding.c -L /usr/local/lib -lavcodec -lavformat -lavutil
-
Environment variable LIBRARY_PATH
export LIBRARY_PATH=LIBDIR1:LIBDIR2:$LIBRARY_PATH
-
System default library location /lib, /usr/lib