我使用MSYS2和MinGW从源代码编译了ffmpeg。库文件在编译期间成功创建,当make实用程序继续构建ffmpeg_g时,我得到了很多未定义的引用。请告诉我为什么编译失败.... 提前致谢
成功生成了以下库文件
libavcodec.a
libavdvice.a
libavfilter.a
libavformat.a
libavutil.a
libpostproc.a
libswresample.a
libswscale.a
通过使用-d选项和mke编译ffmpeg_g.exe输出的命令传递
g++ -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,--nxcompat -Wl,--dynamicbase -Wl,--as-needed -Wl,--warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -o ffmpeg_g.exe ffmpeg_opt.o ffmpeg_filter.o ffmpeg.o cmdutils.o -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswresample -lswscale -lavutil -lavicap32 -lpsapi -lole32 -lstrmiids -luuid -lws2_32 -lx264 -lvpx -lvpx -lvpx -lvpx -lvorbisenc -lvorbis -logg -lopenjpeg -lmp3lame -lfdk-aac -lfaac -lbluray -L/mingw32/lib -lass -lm -lharfbuzz -lfontconfig -lexpat -lfreetype -lexpat -lenca -lm -lfribidi -lglib-2.0 -lintl -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -lfreetype -lz -lbz2 -lm -lbz2 -lz -lpsapi -ladvapi32 -lshell32
gcc的输出如下所示
ffmpeg_opt.o: In function new_output_stream:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:1036: undefined reference to avcodec_get_context_defaults3
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:1089: undefined reference to av_get_exact_bits_per_sample
ffmpeg_opt.o: In function find_codec_or_die:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:514: undefined reference to avcodec_find_encoder_by_name
ffmpeg_opt.o: In function choose_encoder:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:965: undefined reference to avcodec_find_encoder
ffmpeg_opt.o: In function find_codec_or_die:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:518: undefined reference to avcodec_find_encoder
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:514: undefined reference to avcodec_find_decoder_by_name
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:518: undefined reference to avcodec_find_decoder
ffmpeg_opt.o: In function add_input_streams:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:596: undefined reference to av_codec_get_lowres
ffmpeg_opt.o: In function choose_decoder:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:546: undefined reference to avcodec_find_decoder
ffmpeg_opt.o: In function add_input_streams:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:546: undefined reference to avcodec_find_decoder
ffmpeg_opt.o: In function open_input_file:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:872: undefined reference to avcodec_get_class
ffmpeg_opt.o: In function add_input_streams:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:631: undefined reference to avcodec_find_decoder
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:595: undefined reference to avcodec_find_decoder
许多未定义的引用后跟
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/libavcodec/mlpdsp.c:64: undefined reference to ff_mlpdsp_init_x86
libavcodec/libavcodec.a(mpegaudiodsp.o): In function ff_mpadsp_init:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/libavcodec/mpegaudiodsp.c:46: undefined reference to ff_mpadsp_init_x86
libavcodec/libavcodec.a(cavsdsp.o): In function ff_cavsdsp_init:
E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/libavcodec/cavsdsp.c:565: undefined reference to ff_cavsdsp_init_x86
collect2.exe: error: ld returned 1 exit status
输出
LD ffmpeg_g.exe
Reaping losing child 01584DA0 PID 29691080
Makefile:105: recipe for target ffmpeg_g.exe failed
Removing child 01584DA0 PID 29691080 from chain.