Asik
Asik

Reputation: 22123

Unresolved externals trying to use ffmpeg

I'm trying to use some functions from ffmpeg and am running into resilient linker errors. Here's what I did:

This is my main.cpp:

#include "avformat.h"

int main()
{
    av_register_all();
} 

This fails with:

error LNK2019: unresolved external symbol "void __cdecl av_register_all(void)" (?av_register_all@@YAXXZ) referenced in function _main

How can I fix this error?

Upvotes: 9

Views: 8079

Answers (1)

Roger Rowland
Roger Rowland

Reputation: 26279

As you're using C++, you need to surround your ffmpeg #include statements with extern "C" like this :

extern "C"
{
    #include "avformat.h"
}

Upvotes: 39

Related Questions