PDA

View Full Version : Qt Mac g++ Linking Error on while compiling FFMPEG



polin
17th January 2013, 11:08
I've found a strange problem during the compile of an example of ffmpeg in Qt Mac.

I have installed the ffmpeg library and I have tested the examples of this with cc and gcc compiler on the terminal, and I don't have any problem in the case of compile and run.

But when I call the library (ffmpeg are C library) in Qt for compile the same code of the example, the g++ compiler give me many error.

I have used this structure in the main.cpp code:

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>

extern "C" {
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
}

#include <QDebug>

and the Compile Output gives me:

In file included from ../audvid/main.cpp:7:
/opt/local/include/libavutil/timestamp.h: In function 'char* av_ts_make_string(char*, int64_t)':
/opt/local/include/libavutil/timestamp.h:48: warning: comparison between signed and unsigned integer expressions
/opt/local/include/libavutil/timestamp.h:49: error: expected `)' before 'PRId64'
/opt/local/include/libavutil/timestamp.h:49: warning: spurious trailing '%' in format
/opt/local/include/libavutil/timestamp.h:49: warning: too many arguments for format
/opt/local/include/libavutil/timestamp.h: At global scope:
/opt/local/include/libavutil/timestamp.h:68: error: 'AVRational' has not been declared
/opt/local/include/libavutil/timestamp.h: In function 'char* av_ts_make_time_string(char*, int64_t, int*)':
/opt/local/include/libavutil/timestamp.h:70: warning: comparison between signed and unsigned integer expressions
/opt/local/include/libavutil/timestamp.h:71: error: 'av_q2d' was not declared in this scope
../audvid/main.cpp: In function 'int decode_packet(int*, int)':
../audvid/main.cpp:50: error: cannot convert 'AVRational*' to 'int*' for argument '3' to 'char* av_ts_make_time_string(char*, int64_t, int*)'
../audvid/main.cpp:73: error: cannot convert 'AVRational*' to 'int*' for argument '3' to 'char* av_ts_make_time_string(char*, int64_t, int*)'
../audvid/main.cpp:75: error: 'struct AVFrame' has no member named 'channels'
../audvid/main.cpp:84: error: 'struct AVFrame' has no member named 'channels'
../audvid/main.cpp:90: error: 'struct AVFrame' has no member named 'channels'
../audvid/main.cpp: In function 'int open_codec_context(int*, AVFormatContext*, AVMediaType)':
../audvid/main.cpp:112: error: 'av_get_media_type_string' was not declared in this scope
../audvid/main.cpp:123: error: 'av_get_media_type_string' was not declared in this scope
../audvid/main.cpp:129: error: 'av_get_media_type_string' was not declared in this scope
../audvid/main.cpp: In function 'int get_format_from_sample_fmt(const char**, AVSampleFormat)':
../audvid/main.cpp:152: warning: comparison between signed and unsigned integer expressions
../audvid/main.cpp: In function 'int main(int, char**)':
../audvid/main.cpp:239: error: invalid conversion from 'void*' to 'uint8_t**'
make: *** [main.o] Error 1
make: Leaving directory `/Users/polin/Desktop/audvid/audvid-build-Qt_4_8_0_qt_everywhere_opensource_src_4_8_0_tp-Release'
10:44:37: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project audvid (target: Qt 4.8.0 (qt-everywhere-opensource-src-4.8.0-tp))
When executing step 'Make'

I don't understand if I make a mistake in the code or if I must change the Qt compiler? (and I don't know how can do this)