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"
{
connect(button1, SIGNAL(clicked()), this, SLOT(b1click()));
mainLayout->addWidget(bb);
setLayout(mainLayout);
}
void Dialog::b1click()
{
av_register_all();
}
#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();
}
To copy to clipboard, switch view to plain text mode
.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
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
To copy to clipboard, switch view to plain text mode
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)
Bookmarks