Ffmpeg compiler error undefined reference

problem description

ffmpeg compiler error undefined reference to `avformat_version"

wrote a test code using ffmpeg-4.0.2-win64-dev downloaded from ffmpeg"s official website,
but failed to compile

/**
 * test.c
 */
-sharpinclude <stdio.h>

-sharpinclude "libavcodec/avcodec.h"
-sharpinclude "libavformat/avformat.h"
-sharpinclude "libswscale/swscale.h"
-sharpinclude "libavdevice/avdevice.h"

int main()
{
    printf("%d", avformat_version());
    return 0;
}

this is the compiled command
gcc test.c-I include-L lib-lavdevice-lavformat-lavfilter-lavcodec-lswresample-lswscale-lavutil-lm

system is 64-bit win10
ffmpeg is from the latest version of the official website
system has not installed other versions of ffmpeg
extracted from ffmpeg-4.0.2-win64-dev.zip include and lib these two folders are also placed in the same directory as the source code (test.c)
link library order is referred to makefile
in exmaple, so there is no need to add extern "C" like CPP

because it is compiled in gcc

can any great god tell me how to troubleshoot this situation


the problem lies in the version of ffmpeg. Changing the version of ffmpeg from 64-bit to 32-bit solves the problem

.
Menu