[FFmpeg-devel] MinGW compilation with --enable-libfaac / --enable-libfaad broken, adding #define WIN32 fixes it
Alexander Almaleh
sashoalm
Fri Aug 22 09:10:58 CEST 2008
Hi,
I don't know if this is of interest for you, but someone in the user mailing
list said I should post here the problem and what solution worked for me.
When ffmpeg was compiled with these options on Windows with MinGW
./configure --enable-memalign-hack --enable-shared --disable-static
--enable-libmp3lame --enable-libfaac --enable-libfaad
--extra-cflags=-I/local/include --extra-ldflags=-L/local/lib
the compiler gave these errors:
libavcodec/libfaac.c:142: undefined reference to `faacEncClose'
libavcodec/libfaac.o: In function `Faac_encode_frame':
libavcodec/libfaac.c:126: undefined reference to `faacEncEncode'
libavcodec/libfaac.o: In function `Faac_encode_init':
libavcodec/libfaac.c:44: undefined reference to `faacEncOpen'
libavcodec/libfaac.c:49: undefined reference to
`faacEncGetCurrentConfiguration'
libavcodec/libfaac.c:73: undefined reference to `faacEncClose'
libavcodec/libfaac.c:112: undefined reference to `faacEncSetConfiguration'
libavcodec/libfaac.c:100: undefined reference to
`faacEncGetDecoderSpecificInfo'
libavcodec/libfaac.c:52: undefined reference to `faacEncClose'
libavcodec/libfaad.o: In function `faac_decode_init':
libavcodec/libfaad.c:249: undefined reference to `faacDecOpen'
libavcodec/libfaad.c:250: undefined reference to `faacDecClose'
libavcodec/libfaad.c:251: undefined reference to
`faacDecGetCurrentConfiguration'
libavcodec/libfaad.c:252: undefined reference to `faacDecSetConfiguration'
libavcodec/libfaad.c:253: undefined reference to `faacDecInit'
libavcodec/libfaad.c:254: undefined reference to `faacDecInit2'
libavcodec/libfaad.c:255: undefined reference to `faacDecDecode'
libavcodec/libfaad.c:271: undefined reference to `faacDecOpen)
What fixed it was adding #define WIN32 before the #include statements for
the faac and faad headers, like this:
/**
* @file libfaac.c
* Interface to libfaac for aac encoding.
*/
#include "avcodec.h"
#define WIN32 // this had to be added
#include <faac.h>
and this:
/**
* @file faad.c
* AAC decoder.
*
* still a bit unfinished - but it plays something
*/
#include "avcodec.h"
#define WIN32 // this had to be added
#include "faad.h"
and the problem seemed to be around here:
// in faac.h
#ifdef WIN32
# ifndef FAACAPI
# define FAACAPI __stdcall
# endif
#else
# ifndef FAACAPI
# define FAACAPI
# endif
#endif
and
// in faad.h
#ifdef WIN32
#pragma pack(push, 8)
#ifndef FAADAPI
#define FAADAPI __stdcall
#endif
#else
#ifndef FAADAPI
#define FAADAPI
#endif
#endif
IMO, FAACAPI and FAADAPI were declared wrong otherwise, and it couldn't
recognize the functions because of the calling convention. I have a six
months old revision from 03/24/2008, and it compiles with the same
msys/mingw environment and flags, so the problem was introduced somewhere
between those revisions.
More information about the ffmpeg-devel
mailing list