android ktv 开发过程3-undefined reference to `img_convert'

使用yum安装ffmpeg出现后,编译example.c时老是出问题。使用源码重新安装,编译1000行代码tutorial01.c 时出错。

使用编译实例文件里面的编译命令失败。

出现undefined reference to `img_convert'错误。解决方法:使用下面两个函数代替 img_convert(。。。。):

	img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
 		pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height,
 		PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
	// other codes
	// Convert the image from its native format to RGB
	sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize,
		 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);

在#include <stdio.h>下面加上:static struct SwsContext *img_convert_ctx;

编译出现tutorial01.c:(.text+0x3f7): undefined reference to `sws_getContext'tutorial01.c:(.text+0x451): undefined reference to `sws_scale'错误。

解决方法:使用下面的编译命令:gcc -o tt tutorial01.c  -lavformat -lavcodec -lavutil -lswscale 

终于编译成功。

android ktv开发过程太慢了。。

posted @ 2011-04-25 16:29  jrvin  阅读(1804)  评论(0编辑  收藏  举报