我有两台装有Ubuntu 12.04.2 LTS(64 mb)的机器,另一台是雪豹操作系统。在我的mac中,我使用ffmpeg没有任何问题,但后来我尝试在ubuntu中使用ffmpeg,出现了6700(!)个错误:
error: undefined reference to `av_freep'
error: undefined reference to `av_strstart'
error: undefined reference to `av_freep'
...
我使用QT 4.8.5和g++x86 64b我安装了以下ffmpeghttp://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide没有错误或警告。
我的测试代码是:
.h
QT += core gui
INCLUDEPATH +=
/usr/local/Include
LIBS += /usr/local/lib/libavcodec.a
LIBS += /usr/local/lib/libavutil.a
LIBS += /usr/local/lib/libavformat.a
LIBS += /usr/local/lib/libswscale.a
SOURCES += main.cpp
.cpp:
extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
}
#include <stdio.h>
int main()
{
AVFormatContext *pFormatCtx;
av_register_all();
const char* fil = "/home/cits/Desktop/movFile.mov";
if(avformat_open_input(&pFormatCtx, fil, NULL, NULL)!=0)
{
return -1; // Couldn't open file
}
if(avformat_find_stream_info(pFormatCtx, NULL)<0)
{
return -1; // Couldn't find stream information
}
return 0;
}
有什么想法吗??
提前谢谢。
你的.pro文件应该读起来像:
QT += core gui
INCLUDEPATH +=
/usr/local/Include
LIBS += -L/usr/local/lib/ -llibavcodec -llibavutil -llibavformat -llibswscale
SOURCES += main.cpp