[Libav-user] Demo program error

Alex Zelid alex at zelid.com
Mon Dec 8 00:38:33 CET 2014


Hello,

I just started playing with libav and tried very simple demo that doesn't
work whatever I tried.

This is my demo code:

main.c
--------------
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#ifdef HAVE_AV_CONFIG_H
#undef HAVE_AV_CONFIG_H
#endif

#include "libavcodec/avcodec.h"
#include "libavutil/mathematics.h"

#define INBUF_SIZE 4096
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096

int main(int argc, char **argv)
{
    const char *filename;

    /* must be called before using avcodec lib */
    avcodec_register_all();

    printf("Done!\r\n");
    return 0;
}


I compile it using:

i686-w64-mingw32.static-gcc
-I/home/alex/opt/mxe/usr/i686-w64-mingw32.static/include main.c
-L/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib  -lavformat -lavcodec
-lavutil -lswscale -lmp3lame -lvorbis -lvorbisenc -lxvidcore -pthread
-ltheora -lx264 -lz -lbz2 -lm -llzma -lswscale -lswresample

I get this error:
/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib/libavcodec.a(libopencore-amr.o):libopencore-amr.c:(.text+0x72):
undefined reference to `Decoder_Interface_Decode'
/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib/libavcodec.a(libopencore-amr.o):libopencore-amr.c:(.text+0xd0):
undefined reference to `D_IF_exit'
/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib/libavcodec.a(libopencore-amr.o):libopencore-amr.c:(.text+0x152):
undefined reference to `D_IF_decode'
/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib/libavcodec.a(libopencore-amr.o):libopencore-amr.c:(.text+0x574):
undefined reference to `Encoder_Interface_Encode'
/home/alex/opt/mxe/usr/bin/i686-w64-mingw32.static-ld:
/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib/libavcodec.a(libopencore-amr.o):
bad reloc address 0x0 in section `.data'
/home/alex/opt/mxe/usr/bin/i686-w64-mingw32.static-ld: final link failed:
Invalid operation
collect2: error: ld returned 1 exit status

libav was compiled statically on Ubuntu with MXE (https://github.com/mxe/mxe
master) cross-build i686-mingw-w64

Please help me with this first build to start playing with libav cool
things.

Thanks!

-Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141208/1082bcc7/attachment.html>


More information about the Libav-user mailing list