#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    UK
    Posts
    41
    Rep Power
    7

    FFMpeg imports cause linker to have undefined references to QT methods


    I've been tracing a couple of undefined references for around a day now. Simply put, I am trying to convert an FFMpeg AVFrame into a QT4 QVideoFrame. However when I include any of these ffmpeg headers;
    Code:
    extern "C" {
    #include <libavcodec/avcodec.h>
    #include <libswscale/swscale.h>
    #include <libavformat/avformat.h>
    #include <libavfilter/avfiltergraph.h>
    #include <libavfilter/avcodec.h>
    #include <libavfilter/buffersink.h>
    #include <libavfilter/buffersrc.h>
    #include <libavdevice/avdevice.h>
    }
    The linker stops recognising 2 of the constructors for QVideoFrame all my other QT code and the other constructors for this class work fine.
    Code:
    QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format);
    QVideoFrame (QAbstractVideoBuffer * buffer, const QSize & size, PixelFormat format)
    which causes the link error/s;
    Code:
    ~myfile.cpp:13: undefined reference to `_imp___ZN11QVideoFrameC1EiRK5QSizeiNS_13AVPixelFormatE'
    collect2: ld returned 1 exit status
    First instinct suggests to me that somehow there is an extern "C" leak onto my use of the constructor, causing its name not to be C++ name mangled and hence the reference not found. However then why is it only occurring for these 2 references and no other QT references.

    Basically this issue goes way over my knowledge of c++ compile/linkers, I've also had this occur with mingw 4.4 and 4.6.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    UK
    Posts
    41
    Rep Power
    7
    I fixed this by placing my ffmpeg includes last, presumably the ffmpeg includes of system headers were being compiled as C not C++, causing my issue.
    Last edited by robadob123; November 25th, 2013 at 06:35 PM.

IMN logo majestic logo threadwatch logo seochat tools logo