mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mingw-cross-env-list] Error linking libavcodec


From: Alex Zelid
Subject: [Mingw-cross-env-list] Error linking libavcodec
Date: Mon, 8 Dec 2014 15:20:07 +0200

Hello,

I'm very new to MXE and it's my first attempt to link libraries built with MXE

I tried to compile very simple demo program to test linking with MXE libraries, here is the source 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;
    avcodec_init();
    avcodec_register_all();
    printf("Done!\r\n");
    return 0;
}


I compile it using:

~/workspace/c_demo2_avcodec_basic$ i686-w64-mingw32.static-gcc -I/home/alex/opt/mxe/usr/i686-w64-mingw32.static/include main.c -lkernel32 -L/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib -L/home/alex/opt/mxe/usr/i686-w64-mingw32.static/lib -lusp10 -lmsimg32 -lgdi32 -lbz2 -lharfbuzz_too -lws2_32 -lole32 -lshlwapi -lavutil -lwinmm -lwsock32 -lmman -lpthread -lz -lavutil -lm -lavformat -lavutil -lmp3lame -lz -lbz2 -llzma -lswresample -lavcodec -lavutil -lavformat -lz -lm -llzma -lswresample -lmp3lame -lvorbisenc -lrtmp -lswscale

I tried different libs (add and remove) all the time I get error:

/tmp/ccLPW311.o:main.c:(.text+0xf): undefined reference to `avcodec_init'
/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

What do I do wrong and how to link with libavcodec?

I use static i686-w64-mingw32 built from MXE master 7-december-2014

Thank you!

-Alex

reply via email to

[Prev in Thread] Current Thread [Next in Thread]