ffmpeg库在qmake下的pkg-config配置

来源:互联网 发布:华视f6网络机顶盒刷机 编辑:程序博客网 时间:2024/04/20 18:35

qmake编译的选项:

./configure --extra-cflags=-I/home/wayne/out/include --extra-ldflags=-L/home/wayne/out/lib --enable-libx264 --enable-encoder=libx264 --enable-libfaac --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-x11grab --enable-libpulse --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libx265 --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264 


然后试着用qmake编译doc/examples下的例子,却出错了

avio_reading.c:129:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
g++ -m64 -Wl,-O1 -o testFfmpeg avio_reading.o   -lavcodec -lavutil -lavformat -lswscale -lsoxr 
avio_reading.o: In function `main':
avio_reading.c:(.text.startup+0x192): undefined reference to `av_err2str'
collect2: error: ld returned 1 exit status
make: *** [testFfmpeg] Error 1


折腾了一会. 原来想当然的直接把/home/wayne/out/lib/pkgconfig目录的内容 拷贝到系统目录/usr/lib/pkgconfig下是行不通的。

得放在环境变量PKG_CONFIG_PATH里:


export PKG_CONFIG_PATH=/home/wayne/out/lib/pkgconfig:$PKG_CONFIG_PATH

顺带着给出我的pro文件吧:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += avio_reading.c
#DEFINES += __STDC_CONSTANT_MACROS
CONFIG      += link_pkgconfig
PKGCONFIG   += libavcodec libavutil libavformat libavdevice\
 libavresample libswresample  libavfilter libswscale soxr



0 0
原创粉丝点击