Estou usando o Eclipse IDE 4.8.0M4 no Ubunto 16.04. Eu tento compilar o código de um tutorial do FFmpeg no GitHUB: ( link ) . Para configurar o FFmpeg no Eclipse eu usei este guia :( link ).
Os arquivos de cabeçalho e as bibliotecas estão todos na pasta / home / git / ffmpeg. (por exemplo, avcodec.h e libavcodec.a estão na pasta / home / git / ffmpeg / libavcodec). Libs incluídas: -lavcodec -lpostproc -lz -llzma -lrt -lavfilter -lswresample -lavdevice -lswscale -lavutil -lavformat
Saída do console:
12:34:30 **** Incremental Build of configuration Debug for project ffmpeg_test ****
make all
Building target: ffmpeg_test
Invoking: GCC C Linker
gcc -L/home/git/ffmpeg/libavcodec -L/home/git/ffmpeg/libavformat -o "ffmpeg_test" ./src/simpletest.o -lavcodec -lpostproc -lz -llzma -lrt -lavfilter -lswresample -lavdevice -lswscale -lavutil -lavformat
./src/simpletest.o: In function 'main':
/home/boergi/eclipse-workspace/ffmpeg_test/Debug/../src/simpletest.c:141: undefined reference to 'avcodec_parameters_to_context'
/home/boergi/eclipse-workspace/ffmpeg_test/Debug/../src/simpletest.c:163: undefined reference to 'av_packet_alloc'
/home/boergi/eclipse-workspace/ffmpeg_test/Debug/../src/simpletest.c:194: undefined reference to 'av_packet_free'
./src/simpletest.o: In function 'decode_packet':
/home/boergi/eclipse-workspace/ffmpeg_test/Debug/../src/simpletest.c:214: undefined reference to 'avcodec_send_packet'
/home/boergi/eclipse-workspace/ffmpeg_test/Debug/../src/simpletest.c:225: undefined reference to 'avcodec_receive_frame'
collect2: error: ld returned 1 exit status
makefile:30: recipe for target 'ffmpeg_test' failed
make: *** [ffmpeg_test] Error 1
12:34:31 Build Finished (took 519ms)
Descobri que " int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
" está definido em utils.c (também na pasta / libavcodec), mas não sei o que posso fazer para que isso aconteça.
boergi@Ubuntu-b:~/git/ffmpeg$ ffmpeg -version
ffmpeg version N-89895-g7723750 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
configuration:
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 5.101 / 58. 5.101
libavdevice 58. 0.101 / 58. 0.101
libavfilter 7. 11.101 / 7. 11.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101