Results 1 to 3 of 3

Thread: linking problem (ffmpeg)

  1. #1
    Join Date
    Dec 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default linking problem (ffmpeg)

    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:
    Qt Code:
    1. #include "dialog.h"
    2.  
    3. #include <QtGui>
    4. #include <QPushButton>
    5. #include <QVBoxLayout>
    6.  
    7. #include "libavcodec/avcodec.h"
    8. #include "libavformat/avformat.h"
    9.  
    10.  
    11. Dialog::Dialog(QWidget *parent) : QDialog(parent)
    12. {
    13. button1 = new QPushButton(tr("Button one!"));
    14. connect(button1, SIGNAL(clicked()), this, SLOT(b1click()));
    15.  
    16. mainLayout = new QVBoxLayout(this);
    17. mainLayout->addWidget(bb);
    18.  
    19. setLayout(mainLayout);
    20. }
    21.  
    22. void Dialog::b1click()
    23. {
    24. av_register_all();
    25. }
    To copy to clipboard, switch view to plain text mode 

    .pro file:
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += . ./ffmpeg ./ffmpeg/libavformat ./ffmpeg/libavcodec ./ffmpeg/libavutil
    5.  
    6. # Input
    7. HEADERS += dialog.h norwegianwoodstyle.h widgetgallery.h blackbutton.h circlewidget.h
    8. SOURCES += dialog.cpp main.cpp norwegianwoodstyle.cpp widgetgallery.cpp blackbutton.cpp circlewidget.cpp
    9. RESOURCES += Pokus.qrc
    10.  
    11. QT += svg
    12.  
    13. 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)
    Last edited by wysota; 14th December 2008 at 15:28.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: linking problem (ffmpeg)

    Is the symbol exported? Try opening the DLL for example to the Dependency Walker.
    J-P Nurmi

  3. #3
    Join Date
    May 2008
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: linking problem (ffmpeg)

    uses
    extern "C"
    {
    #include "libavcodec/avcodec.h"
    #include "libavformat/avformat.h"
    };
    and include the ffmpeg header files this wil solve the "undefined reference"

Similar Threads

  1. problem in linking with libqtiff.dylib
    By nareshqt in forum Qt Programming
    Replies: 1
    Last Post: 20th June 2008, 14:19
  2. problem with order of libs during linking
    By minimax in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2008, 11:32
  3. Linking problem on Mac os x 10.4
    By maverick_pol in forum General Programming
    Replies: 0
    Last Post: 6th January 2008, 15:09
  4. why linking problem with QGLWidget???
    By Shuchi Agrawal in forum Newbie
    Replies: 17
    Last Post: 16th March 2007, 11:45
  5. Runtime dynamic linking + Qt4 problem
    By _Ramirez_ in forum Qt Programming
    Replies: 5
    Last Post: 11th February 2006, 15:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.