Generally the error means that the library binary libx264.so
picked up by the linker does not match the version in the header file x264.h
. See the following lines of code in this header file:
/* Force a link error in the case of linking against an incompatible API version.
* Glue #defines exist to force correct macro expansion; the final output of the macro
* is x264_encoder_open_##X264_BUILD (for purposes of dlopen). */
#define x264_encoder_glue1(x,y) x##y
#define x264_encoder_glue2(x,y) x264_encoder_glue1(x,y)
#define x264_encoder_open x264_encoder_glue2(x264_encoder_open_,X264_BUILD)
The solution usually does not require building libx264 yourself,
just make sure that you installed libx264-dev
properly without interference with other versions, which may also be in /usr/local/lib
or the like.
I had the same issue with version 155:
undefined reference to 'x264_encoder_open_155'
.
In my case this was because I had in /usr/lib/x86_64-linux-gnu
and unsuitable copy of libx264.so
(which I had produced myself and uncleanly copied there).
So all I had to do was sudo apt-get install --reinstall libx264-dev
.