How to Setup Code::Blocks IDE for FFmpeg development

I am digging into a project that needs to use some open source video codec library. FFmpeg is very powerful video codec library, which I decided to use in my project. I compiled and installed the ffmpeg library, then the problem comes, how to use the library in my project conviniently. My first thought is to write make file. I am not an expert in makefile things, so I changed to try to use Code::Blocks IDE, which is very easy to use. After configuring the include path and adding all the ffmpeg static library files mannully, I still can't build the project successfully.

I think I should check how FFmpeg build the library. After running make in /doc/examples directory of ffmpeg package, I get the command lines of compiling and linking these examples, I should add these settings in Code::Blocks.

In Linker settings of Code::Blocks, add "other linker options": -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lswresample -lswscale -lavutil -lrt -lmLeave compiler setting unchanged.

After changed setting, I can build a very simple test program which called ffmpeg API. but, when I tried to build ffmpeg example project imported from ffmpeq package, many warnings appeared:

...

/home/wanghaiyang/project/video_watermarking/transcoding.c:111:9: 警告: 不建议使用‘codec’(声明于 /usr/local/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
/home/wanghaiyang/project/video_watermarking/transcoding.c:112:9: 警告: 不建议使用‘codec’(声明于 /usr/local/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
/home/wanghaiyang/project/video_watermarking/transcoding.c:157:13: 警告: 不建议使用‘avcodec_copy_context’(声明于 /usr/local/include/libavcodec/avcodec.h:4240) [-Wdeprecated-declarations]
/home/wanghaiyang/project/video_watermarking/transcoding.c:157:13: 警告: 不建议使用‘codec’(声明于 /usr/local/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
/home/wanghaiyang/project/video_watermarking/transcoding.c:158:21: 警告: 不建议使用‘codec’(声明于 /usr/local/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]

...

In Code::Blocks, the linker failed!

I think the problem lies in the -Wdeprecated-declarations, so I added a compiler option to bypass these warnings:

in compiler setting page, add in "other options": -Wno-deprecated-declarations

then, the project built successfully in Code:Blocks!

转载于:https://www.cnblogs.com/WeirdWiredThings/p/6082942.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值