Archive for May 2009

So I just spent an hour a little too deep inside my linker.

I wanted to compile a little C++ program using libavcodec, libavformat et al. (the ffmpeg stuff), but it just failed.

Solution: the evil C fundamentalists behind the libraries didn’t include the usual declaration of the calling convention that C++ needs when calling C libraries.

So one has to add them manually by surrounding the include declaration with extern "C".

extern "C" {
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}

Now it compiles and links. It does segfault though, but that should be a problem on my part.