PDA

View Full Version : linking problem (ffmpeg)



kralyk
14th December 2008, 14:37
Hi Im new here and Im also quite new to Qt programming.
Im trying to put together a small application that would use ffmpeg's libavcodec and libavformat (and libavutil of course)
but I just cant make it to work due to a linking problem which I cant solve...

source:


#include "dialog.h"

#include <QtGui>
#include <QPushButton>
#include <QVBoxLayout>

#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"


Dialog::Dialog(QWidget *parent) : QDialog(parent)
{
button1 = new QPushButton(tr("Button one!"));
connect(button1, SIGNAL(clicked()), this, SLOT(b1click()));

mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(bb);

setLayout(mainLayout);
}

void Dialog::b1click()
{
av_register_all();
}


.pro file:

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += . ./ffmpeg ./ffmpeg/libavformat ./ffmpeg/libavcodec ./ffmpeg/libavutil

# Input
HEADERS += dialog.h norwegianwoodstyle.h widgetgallery.h blackbutton.h circlewidget.h
SOURCES += dialog.cpp main.cpp norwegianwoodstyle.cpp widgetgallery.cpp blackbutton.cpp circlewidget.cpp
RESOURCES += Pokus.qrc

QT += svg

LIBS += -L. -lavutil -lavformat -lavcodec

Build output:

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\Apps\Qt\4.4.3\include\QtCore" -I"..\..\..\Apps\Qt\4.4.3\include\QtCore" -I"..\..\..\Apps\Qt\4.4.3\include\QtGui" -I"..\..\..\Apps\Qt\4.4.3\include\QtGui" -I"..\..\..\Apps\Qt\4.4.3\include\QtSvg" -I"..\..\..\Apps\Qt\4.4.3\include\QtSvg" -I"..\..\..\Apps\Qt\4.4.3\include" -I"." -I"ffmpeg" -I"ffmpeg\libavformat" -I"ffmpeg\libavcodec" -I"ffmpeg\libavutil" -I"c:\Apps\Qt\4.4.3\include\ActiveQt" -I"debug" -I"." -I"..\..\..\Apps\Qt\4.4.3\mkspecs\default" -o debug\dialog.o dialog.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Pokus.exe object_script.Pokus.Debug -L"c:\Apps\Qt\4.4.3\lib" -lmingw32 -lqtmaind -L. -lavutil -lavformat -lavcodec -lQtSvgd4 -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Prog/Qt/Pokus'
mingw32-make: Leaving directory `C:/Prog/Qt/Pokus'
./debug\dialog.o: In function `_ZN6Dialog7b1clickEv':
C:/Prog/Qt/Pokus/dialog.cpp:30: undefined reference to `av_register_all()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\Pokus.exe] Error 1
mingw32-make: *** [debug] Error 2
Exited with code 2.

My system is Win32 XP, Qt is 4.4.3 compiling with mingw32
ffmpeg downloaded from SVN and compiled using MSYS & mingw32

Any help appreciated!

(English is not my native language - sorry for possible language mistakes)

jpn
26th December 2008, 14:02
Is the symbol exported? Try opening the DLL for example to the Dependency Walker.

wesley.antony
13th April 2009, 08:35
uses
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
};
and include the ffmpeg header files this wil solve the "undefined reference"