PDA

View Full Version : linking problem (own build libavformat)



entee
5th October 2011, 19:27
Hi!

I'd like to use libavformat and libavcodec in my app.
I need the newest, but it isn't in repository (I use ubuntu 11.04), so I built one. I'd like to use it from myapp-build/lib .

I include headers in my cpp:


extern "C"
{
#include "include/libavcodec/avcodec.h"
#include "include/libavformat/avformat.h"
}

and I put these rows to my .pro file:

INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include

unix:LIBS += -Llib/ -lavcodec
unix:LIBS += -Llib/ -lavformat

but it still use the older libs.
I tried it with absolute path too.
What should I do?
I use QtCreator and I checked LD_LIBRARY_PATH in the run settings.

entee
6th October 2011, 15:52
Solution:

LIBS += -L/dir/of/my/lib \
-l:libavutil.so.51.9.1 \
-l:libavformat.so.53.4.0 \
-l:libavcodec.so.53.7.0

I use opencv, and it's highgui modul used the older avcodec. I have to give the full file name of the libs.